I am new to arduino and I want to interface it using java . I want to know is there a way to change the variable or set the variable using the input from java :D Thanks For reading Hope you can answer my question .. Sorry for my english not my first language :D
Although you can't straight-up change variables on the Arduino, you can create your own protocol over a serial connection using processing (https://processing.org) on your computer, and a sketch on Arduino.
Use the function
on the arduino to initialise a serial connection to your computer, and then in processing use the lines:
Serial myPort; // Initialise a serial object (do this at the start of the program) // Inside the setup() function: String portName = Serial.list(); // Get the first portname on the list (this may need to be changed to get the right one) myPort = new Serial(this, portName, 9600);
to connect from the computer.
Once you have done this, you can use the functions
in processing, and
val = Serial.read();
To recieve data on the arduino.
Source (see here for more info): https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all