Serial.read() gives null value from Arduino and or the port is not open on processing side

Actually this is important. This line is in the global scope. You should do instead

Serial myPort;

void setup(){
   myPort = new Serial(this, Serial.list()[0], 9600);
   ....

}

At the end of setup() you should add a delay of 500 or 1000 ms as some units seem to go into a reset cycle. This delay will ensure the unit is ready. However, I am not sure if this applies in your case. Just add delay(1000);.

Kf

1 Like