ダメだったときフロー - 1ft-seabass/wio-node-handson-201612 GitHub Wiki

[{"type":"tab","id":"9b2f4f6b.2fb84","label":"Flow 1"},{"id":"29315932.989006","type":"inject","z":"9b2f4f6b.2fb84","name":"1sec","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":290,"y":160,"wires":[](/1ft-seabass/wio-node-handson-201612/wiki/)},{"id":"a0b7740f.3ea6a8","type":"debug","z":"9b2f4f6b.2fb84","name":"","active":true,"console":"false","complete":"false","x":630,"y":160,"wires":[]},{"id":"1aa5dbf.82d9924","type":"http request","z":"9b2f4f6b.2fb84","name":"Wio GET","method":"GET","ret":"txt","url":"https://us.wio.seeed.io/v1/node/GenericAInA0/analog?access_token=ABCDE12345","x":460,"y":160,"wires":["a0b7740f.3ea6a8"](/1ft-seabass/wio-node-handson-201612/wiki/"a0b7740f.3ea6a8")},{"id":"301f9dc7.f83572","type":"inject","z":"9b2f4f6b.2fb84","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"x":229,"y":346,"wires":["b4d75377.7eb07"](/1ft-seabass/wio-node-handson-201612/wiki/"b4d75377.7eb07")},{"id":"b4d75377.7eb07","type":"function","z":"9b2f4f6b.2fb84","name":"URL設定","func":"// ここに https://us.wio.seeed.io/v1/node/GroveLEDBarUART0/level/からはじまる一文を加えます。\nmsg.url = \"https://us.wio.seeed.io/v1/node/GroveLEDBarUART0/level/[level]?access_token=ABCDE12345\";\n// 来た値を差し替え\nmsg.url = msg.url.split(\"[level]\").join(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":400,"wires":["e70d56d3.c9aee8"](/1ft-seabass/wio-node-handson-201612/wiki/"e70d56d3.c9aee8")},{"id":"e70d56d3.c9aee8","type":"http request","z":"9b2f4f6b.2fb84","name":"Wio POST","method":"POST","ret":"txt","url":"","x":570,"y":400,"wires":["113ec355.97a30d"](/1ft-seabass/wio-node-handson-201612/wiki/"113ec355.97a30d")},{"id":"e79a0a6a.7bc698","type":"inject","z":"9b2f4f6b.2fb84","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"x":230,"y":400,"wires":["b4d75377.7eb07"](/1ft-seabass/wio-node-handson-201612/wiki/"b4d75377.7eb07")},{"id":"66cecad0.df7054","type":"inject","z":"9b2f4f6b.2fb84","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":230,"y":460,"wires":["b4d75377.7eb07"](/1ft-seabass/wio-node-handson-201612/wiki/"b4d75377.7eb07")},{"id":"804fc93a.23c298","type":"comment","z":"9b2f4f6b.2fb84","name":"↓ ここをつなげる","info":"","x":401,"y":102,"wires":[]},{"id":"94e84e5a.31566","type":"comment","z":"9b2f4f6b.2fb84","name":"1.光センサー取得","info":"","x":99,"y":161,"wires":[]},{"id":"fd076def.a503c","type":"comment","z":"9b2f4f6b.2fb84","name":"2.LED Bar操作","info":"","x":100,"y":280,"wires":[]},{"id":"113ec355.97a30d","type":"debug","z":"9b2f4f6b.2fb84","name":"","active":true,"console":"false","complete":"false","x":750,"y":400,"wires":[]},{"id":"72111830.c15ef8","type":"debug","z":"9b2f4f6b.2fb84","name":"","active":false,"console":"false","complete":"false","x":970,"y":760,"wires":[]},{"id":"edb47ea1.692be","type":"http request","z":"9b2f4f6b.2fb84","name":"Wio POSTs","method":"POST","ret":"txt","url":"","x":810,"y":720,"wires":["72111830.c15ef8"](/1ft-seabass/wio-node-handson-201612/wiki/"72111830.c15ef8")},{"id":"6efcede6.8d2c44","type":"function","z":"9b2f4f6b.2fb84","name":"LED Bar 設定","func":"var level = Math.floor(10 * msg.payload.analog / 1024);\n\nmsg = {};\n// ここに https://us.wio.seeed.io/v1/node/GroveLEDBarUART0/level/からはじまる一文を加えます。\nmsg.url = \"https://us.wio.seeed.io/v1/node/GroveLEDBarUART0/level/[level]?access_token=ABCDE12345\";\n// 光センサーは0-1024で動くのでBarの10レベルに変える\n\nmsg.url = msg.url.split(\"[level]\").join(level);\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":720,"wires":["edb47ea1.692be"](/1ft-seabass/wio-node-handson-201612/wiki/"edb47ea1.692be")},{"id":"2cc9223a.90145e","type":"json","z":"9b2f4f6b.2fb84","name":"文字列をJSON化","x":510,"y":660,"wires":["6efcede6.8d2c44"](/1ft-seabass/wio-node-handson-201612/wiki/"6efcede6.8d2c44")},{"id":"b39871ed.8e75f","type":"http request","z":"9b2f4f6b.2fb84","name":"光 GET","method":"GET","ret":"txt","url":"https://us.wio.seeed.io/v1/node/GenericAInA0/analog?access_token=ABCDE12345","x":340,"y":660,"wires":["2cc9223a.90145e"](/1ft-seabass/wio-node-handson-201612/wiki/"2cc9223a.90145e")},{"id":"6ab5483f.2e20d8","type":"inject","z":"9b2f4f6b.2fb84","name":"1sec","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":130,"y":660,"wires":[](/1ft-seabass/wio-node-handson-201612/wiki/)},{"id":"1dd1f541.aef4bb","type":"comment","z":"9b2f4f6b.2fb84","name":"3.光センサーとLED Barの連携","info":"","x":140,"y":520,"wires":[]},{"id":"9eff2009.1ad5a","type":"comment","z":"9b2f4f6b.2fb84","name":"↓ ここをつなげる","info":"","x":240,"y":580,"wires":[]}]