hello, I have a problem communicating with my arduino leonardo.
This is the processing code:
import processing.serial.*;
Serial myPort; // Create object from Serial class
int val; // Data received from the serial port
void setup()
{
size(200, 200);
// I know that the first port in the serial list on my mac
// is always my FTDI adaptor, so I open Serial.list()[0].
// On Windows machines, this generally opens COM1.
// Open whatever port is the one you're using.
String portName = Serial.list()[1];
println(Serial.list());
myPort = new Serial(this, portName, 9600);
}
void draw()
{
if ( myPort.available() > 0) { // If data is available,
val = myPort.read(); // read it and store it in val
print((char) val);
}
}
and this is the arduino one:
void setup() {
Serial.begin(9600); // Start serial communication at 9600 bps
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
}
void loop() {
delay(1000);
Serial.print("hoila "); // send to Processing
delay(1000);
Serial.print("hoibo "); // send to Processing
}
I receive all char if I use another arduino (not leonardo), or anoter serial terminal with leonardo, but with arduino leo and processing connected on the serial port nothing is read.
Do you have any idea?
thanks in advance