I've read my notes on how to construct nodes with multiple outputs, but it isn't working.
The idea is that the input cycles from 0 to 3 (numbers).
Depending on its value, depends which output is sent a 1
.
All values are set to 0
at the beginning and depending on the payload's value, it sets that message's value to 1
.
Ok, the number of =
signs may be a problem, but I did it with only two and got the same results.
I am getting a lot of undefined
from the node.warn( )
Yet, they are defined at the top.
So I'm missing something.
Sorry but I can't nut it out.
var msg1 = 0;
var msg2 = 0;
var msg3 = 0;
var msg4 = 0;
msg.payload = parseInt(msg.payload);
node.warn("message payload is " + msg.payload);
if (msg.payload === 0)
{
//
msg1.payload = 1;
} else
if (msg.payload === 1)
{
//
msg2.payload = 1;
} else
if (msg.payload === 2)
{
//
msg3.payload = 1;
} else
if (msg.payload === 3)
{
//
msg4.payload = 1;
}
node.warn("--------");
node.warn(msg1.payload);
node.warn(msg2.payload);
node.warn(msg3.payload);
node.warn(msg4.payload);
return [msg1, msg2, msg3, msg4];