0

I'm new into arduino programming and robotics, and I want to use Java to send data to the arduino sketch, to notify it when to use the robots motors. In particular, I have already written a working A* algorithm in Java and would really like to apply this to my arduino robot, so in my java code, when the best state is found, I want to then send data to arduino sketch to notify it what direction to go. Anyone have and ideas as to the best way? I've looked online but haven't anything that really answers this specific question.

Also, I realize I'll need to have the arduino connected via USB to use Java, but for now I'm fine with it

2 Answers2

0

You are going to need JAVA USB API in order to send the data to the USB port where your Arduino is connected. From there you just read the input in your Arduino sketch and you are done.

Ivan Kaloyanov
  • 1,748
  • 6
  • 18
  • 24
0

You can also use a Java Serial Port library (like jssc).

Personally I use Processing (which uses Java) and it's quite easy to do Serial communication with the serial library it ships with.

Check out the SimpleWrite example (which includes example Processing-java code and Arduino code)

George Profenza
  • 50,687
  • 19
  • 144
  • 218