Hello
Hope you guys understand my pore English. Sorry for that.
I have made a button in node-red that sends a 0 or 1 through serial communication to my arduino. (Represents the button state). In arduino I have an if statemant when the value is 1, do something. But i can not let it work.
The button is a simple ui-switch connected to a serial-out-node
I receive the message send to the arduino. When i output this message back i get 48 and 49.
I know this is the decimal code for 0 and 1. The problem is i can not solve the problem to compare this value in arduino.
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
if (incomingByte ==1 ){
puzzelstate=2;
}
}
I tried different things, equal to 1, equal to 49 or even equal to 110001, send it as string, number,...
But the if statement never come true.
What am I doing wrong?
Thanks
Steven