When the program is first started, none of the GUI elements will work except for the combo box and the connect button. I also added key bindings which I can use to control the throttle. See the Code Downloads section for the actual files.Ībove is the picture of the GUI complete with the buttons that I use to interact with the program. However, I did create a GUI for testing purposes. The purpose of this post is to discuss serial programming in Java, and not GUI’s. It could be a motor control, on-off switch, etc. This set up is pretty much using my computer as a remote control for whatever device is on the Arduino end. The Arduino is responsible for reading this data. User input is given from the PC through the a Java GUI that contains code for serial communication, which is the code presented here. I wrote an example program that includes all of those steps in it and are each in their own separate method within the class, but first I will go through my hardware set up. Adding an event listener to listen for incoming data. Generally, communication with serial ports involves these steps (in no particular order): This post also assumes that Java is already properly set up with RXTX. This is more of a follow-up to my previous post about serial programming in Java ( here) and how to install the RXTX libraries ( here).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |