I got a problem over here. I installed JSSC plugin to eclipse. And the problem is how i should communicate?
I mean i got a code on Eclipse:
import jssc.SerialPort;
import jssc.SerialPortException;
public class Main {
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("COM1");
try {
serialPort.openPort();//Open serial port
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);//Set params. Also you can set params by this string: serialPort.setParams(9600, 8, 1, 0);
serialPort.writeBytes("a".getBytes());//Write data to port
serialPort.closePort();//Close serial port
}
catch (SerialPortException ex) {
System.out.println(ex);
}
}
}
I have no idea why, but led is just not turning on
Ok, here's a clue:
serialPort.openPort();//Open serial port
which resets the Arduino.
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);//Set params. Also you can set params by this string: serialPort.setParams(9600, 8, 1, 0);
serialPort.writeBytes("a".getBytes());//Write data to port
serialPort.closePort();//Close serial port
Jam some data at the Arduino while the bootloader is waiting for a new sketch, then close the serial port, resetting the Arduino again.
Your PC program should open the serial port, allow time for the Arduino to reset before trying to send data and then keep the serial port open until the PC program is completely finished with the Arduino.
In my programs I get my Arduino to send "Arduino is ready" from setup() and my PC program waits until it receives that. Look at the link in Reply #9