• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Arduino Read FeedBack using JSerialComm  RSS feed

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Group!

I would like to say thanks for all the help received thus far it has been greatly appreciated. I've written another java program that communicates with an Arduino. Now I can send data to the Arduino just fine however receiving data has been a bit trickier. I would like to change a button color based on the arduino sending data to the java program. My Java code is below. Thanks!


The button does NOT change color when the message from the Arduino is sent which is OFF. Now the word OFF does get print to the console only after the BLINK button has been selected again as well as the button changing color. This needs to happen once the blinking stops.
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure that this will solve your problem but it's generally bad practice to perform long running tasks on the EDT, you should use a worker thread to run the task in the background. If your task is also interacting with the GUI (as yours is) you can use a SwingWorker see this tutorial: https://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html.

BTW why are you calling message.split() and then not using the returned array anywhere.
 
I am a man of mystery. Mostly because of this tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!