Quite simple: msg.payload.inputList = inputNumber;
Mozilla Development Network is the reference.
W3school is easy, fast and simple.
Hope it helps
Quite simple: msg.payload.inputList = inputNumber;
Mozilla Development Network is the reference.
W3school is easy, fast and simple.
Hope it helps
OK so you mean something like that? if (risingEdge) { return msg.payload.inputList = inputNumber;}
than this will happen "TypeError: Cannot create property '_msgid' on number '1'"
Thanks also to Steve-Mcl
appreciate that!
with that construction you are returning just the inputNumber... you need to return the whole msg object... so maybe
if (risingEdge) { msg.payload.inputList = inputNumber; return msg; }
or if you really just want the number
if (risingEdge) { msg.payload = inputNumber; return msg; }
Hello, now I want to detect falling edges of my inputs too. For rising edges this code:
const risingEdge = actualValues.reduce((acc, value, index) => {
if (value && !previousInputs[index]) inputNumber.push(index + 1);
return acc || (value && !previousInputs[index]);
}, false);
works totally fine.
What would I have to change now?
Thanks in advance.
If you want to detect rising edges and falling edges then you just have to look for a change. Feed the value through an RBE node and whenever you get a message then the value has changed. If you need it only when it has changed by more than a certain amount then the RBE node will do that too.