This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • 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: 3320
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!