Hello!
Suddenly my Processing is not reading via serial port what my arduino is sending.
I'm using Arduino UNO and Processing 2.0.6a (I had to migrate to that version from 1.5.1 because there was a mismatch on TXRX libraries that I couldn't fix).
Here is the code:
Arduino
void setup() {
Serial.begin(9600);
}
void loop(){
// read the state of the pushbutton value:
int i=random(1,5);
Serial.println(i,DEC);
delay(1000);
}
Processing
import processing.serial.*;
String portname = "/dev/tty.usbmodem441";
Serial port;
int value=0;
void setup(){
port=new Serial(this,portname,9600);
println("Running");
}
void draw(){
if(port.available() > 0){
value=port.read();
println(value);
}
}
So the arduino is generating some random numbers and sending them through the serial port, and I'm just checking if Processing can read them and print on the serial, but port.read() always is -1 ( I checked it just by printing the value, without the if condition). I don't know what I'm doing wrong because it worked two days ago.
On Processing serial monitor only appears that libraries are stable and "Running".
Thank you!