Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Arduino Read FeedBack using JSerialComm  RSS feed

 
Ranch Hand
Posts: 56
  • 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: 3317
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.
 
pie. tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!