forked from plplatorre/ibmdeveloper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodeRedCode.txt
1 lines (1 loc) · 1.54 KB
/
nodeRedCode.txt
1
[{"id":"215c6601.12d32a","type":"ibmiot in","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"","eventType":"accel","commandType":"","format":"json","name":"IBM IoT App In","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":"","allCommands":"","allFormats":"","x":264.1999969482422,"y":434.1999969482422,"z":"dc6a0ca6.7993b","wires":[["ce21edbb.320628","fdfdaaa2.a45678"]]},{"id":"ce21edbb.320628","type":"function","name":"calc color","func":"var accelZ = msg.payload.d.acceleration_z;\nvar r = 0.0;\nvar b = 0.0;\nvar g = 0.0;\nif (accelZ > 0) {\n\tg = Math.round(accelZ * 25);\n} else if (accelZ < 0) {\n\tr = 255.0;\n} else {\n\tr = 104;\n\tg = 109;\n\tb = 115;\n}\na = 1.0;\n\nmsg.eventOrCommandType = \"color\";\nmsg.payload = JSON.stringify({\"d\":{\"r\":r,\"b\":b,\"g\":g,\"alpha\":a}});\n\nreturn msg;","outputs":1,"noerr":0,"x":437.1999969482422,"y":430.1999969482422,"z":"dc6a0ca6.7993b","wires":[["9df37edb.5d4588"]]},{"id":"9df37edb.5d4588","type":"ibmiot out","authentication":"boundService","apiKey":"","outputType":"cmd","deviceId":"112233445566","deviceType":"Android","eventCommandType":"text","format":"json","data":"{\"d\":{\"value\":\"text\"}}","name":"IBM IoT App Out","service":"registered","x":629.1999969482422,"y":443.1999969482422,"z":"dc6a0ca6.7993b","wires":[]},{"id":"fdfdaaa2.a45678","type":"debug","name":"","active":false,"console":"false","complete":"false","x":442.1999969482422,"y":364.1999969482422,"z":"dc6a0ca6.7993b","wires":[]}]