Hello,
I'm very new to Node-Red, and I'm also very knew to programming. I'm currently using the function node to write the following:
if (msg.payload.pi/11 === 0){
msg.payload = 1;
} else {
msg.payload = 2;
}
return msg;
It appears the problem lies with the /11 part and it should be something like
if (msg.payload.match ( ) === 0){
msg.payload = 1;
} else {
msg.payload = 2;
}
return msg;
My problem is that I don't know what to write inside the ( ) of the match part. Does it have to be some sort of JSON expression?
I'm getting this output (msg.payload.pi/11) from a rpi gpio in node that outputs a digital signal out of pin 11 from a raspberry pi.
Thanks for your help.