Hi All,
I create node to loop an auto increment then decrement. But my code didn't works. Here is my code:
[{"id":"f0e1fc36.bea","type":"debug","z":"d67945fe.28ff9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1089,"y":1024,"wires":[]},{"id":"828e0993.766d1","type":"function","z":"d67945fe.28ff9","name":"","func":"var max = 100;\nvar min = 1;\nvar x = msg.payload;\nvar step = 1;\n\nsetInterval(function() {\n console.log(x);\n x += step;\n if (x === max || x === min) {\n step = -step;\n }\n}, 150);\nmsg.payload = x;\nreturn msg;","outputs":1,"noerr":0,"x":806.5,"y":1058,"wires":[["f0e1fc36.bea"]]},{"id":"234a16e.ee0f8ea","type":"inject","z":"d67945fe.28ff9","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":606.5,"y":1064,"wires":[["828e0993.766d1"]]}]
Thank you for any advice