[Engineering] Arduino to Java Serial Communication 2

In this post, I will talk about using Java as a client and Arduino as a server. To keep it simple, we will only use the Arduino’s built-in LED 13. Before¬†proceeding, please read my other post about Arduino to Java Communication through Serial Port if you haven’t already.

In summary, the only differences in the Java’s side is that we will use jSSC’s serial write method instead of serial read as follows:

serialPort.writeByte(data);

Continue reading

[Engineering] Arduino to Java Serial Communication

Arduino is awesome, but it is pretty much useless as a data acquisition (DAQ) device if we can only read the data in the Arduino IDE. I remember back in Freshman year, worked on a wireless board for my Intro to Engineering project. Back then, not knowing anything really from programming, I decided that it would be cool to make a wireless remote game controller like the Wii controller. So I dug right into it, using the manufacturer’s sample program to get the data I need, write it into a text file, import it into a game I wrote with Game Maker… omg, the errors, the lags. The TA tried to help but it was hopeless, lol. Then I did it again with the Space Hopper project, if I only know how to read Joystick data in Java…

Anyway, did a bit of coding today and this is what I got after messing around for couple hours. Most time was spent trying to get Arduino to send the data out correctly. C++ is just… not my thing. Will probably write a Java Class for it to make it even easier to use.

[WARNING: I REALLY HAVE NO IDEA REALLY WHAT I AM DOING AND SOMEHOW THIS WORKS! THIS PAGE IS JUST TO DOCUMENT MY NOTES!]

Continue reading