Serial communication from node-red to arduino

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

Maybe i found the solution. I am checking my post on the forum and see that my if-statement is in the serial.available statement. Maybe this is the mistake. I try it out and let you know. My brains must be tired.

Yeps that solved my problem. Crazy i overlooked that. I changed my code to

if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();
    
    }
    if (incomingByte == 49 ){
      puzzelstate=2;
      }

It works now, but how can i output from node-red, so i receive a 0 or 1?

To make it more readable

if (incomingByte =='1' )