Reputation: 17337
I'm a beginner with arduino and I would like another program I'll write to read the buttons I'll press to do a launchpad or a piano if you will. So for example I'll have 4 buttons and when I press button 1, I should be able to know that the button 1 has been pressed in my other program written in java so I can play a sample. I'm able to write a java program that reads input (not arduino input) and plays a sample. I'm able to write an arduino program that says what button I've pressed in the console. However I don't know how to bind the two. Any help ?
Edit: I might have found what I'm looking for http://playground.arduino.cc/Interfacing/Java
Upvotes: 3
Views: 123
Reputation: 435
There are different ways to archive this, but as you already posted the simplest way is a java library which handles serial communication as the arduino communicates via usb on a virtual com port.
So anything left to do is sending data via serial(as u usually do for the arduino ide terminal):
Serial.println(nrOfButtonPressed);
And read/evaluate the results via some java serial interface.
Upvotes: 1