{"1":"Show clock/time","2":"Show alarms","3":"Edit time/date","4":"Edit alarm/s","5":"Alarm run time"}
I have done things similar and done things like this before.
They work.
I'm not getting this.
So I have a function node with this code:
var starting = parseInt(msg.payload);
var ending = starting + 2 // set to 2 for now. Just to prove the code set at 2
//node.warn("Starting " + starting)
//node.warn("Ending " + ending)
//node.warn(msg.menu)
if (starting < ending)
{
//
pop()
}
return;
function pop() {
node.warn("Loop" + starting);
node.warn("Ending " + ending);
node.send(msg.menu[starting]);
starting +=1;
if (starting < ending){
pop()
}
}
Yeah, full of node.warn() stuff.
I'm not getting why the node.send(msg.menu[starting]); isn't working.
When the node.warn() line is active I see the structure.
And I am getting this as an error: Function tried to send a message of type string
node.send needs to send an object, unless you configured the debug node to display something else. You are not sending an object, but a number eg. node.send({menu:starting}) - which in turn will output {menu:x}