2021年1月2日 星期六

Node-Red Dashboard 產生一個折線圖

Node-Red Dashboard 產生一個折線圖 




0-100亂數產生器函數

High =100;

Low =0 ;

msg.payload= Math.floor(Math.random() * (1 + High - Low)) + Low ;

return msg;

清除函數 

msg.payload=[];

return msg;

Node-Red程式

[{"id":"9ddd46f4.de3678","type":"function","z":"8bd90afd.137db8","name":"0~100亂數產生器","func":"High =100;\nLow =0 ;\nmsg.payload= Math.floor(Math.random() * (1 + High - Low)) + Low ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":180,"wires":[["5cc339e6.103f08","3401eeb6.c22022"]]},{"id":"5c26f043.9e928","type":"inject","z":"8bd90afd.137db8","name":"5秒鐘 Timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":180,"wires":[["9ddd46f4.de3678"]]},{"id":"31676d8e.5aa592","type":"inject","z":"8bd90afd.137db8","name":"清除","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":260,"wires":[["b978b1dc.17eb7"]]},{"id":"b978b1dc.17eb7","type":"function","z":"8bd90afd.137db8","name":"","func":"msg.payload=[];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":260,"wires":[["3401eeb6.c22022"]]},{"id":"5cc339e6.103f08","type":"debug","z":"8bd90afd.137db8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":180,"wires":[]},{"id":"3401eeb6.c22022","type":"ui_chart","z":"8bd90afd.137db8","name":"","group":"ac0f1141.eb50e","order":61,"width":0,"height":0,"label":"折線圖","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":550,"y":240,"wires":[[]]},{"id":"9cdc2525.961b18","type":"ui_button","z":"8bd90afd.137db8","name":"","group":"ac0f1141.eb50e","order":62,"width":0,"height":0,"passthru":false,"label":"清除","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":300,"wires":[["b978b1dc.17eb7"]]},{"id":"ac0f1141.eb50e","type":"ui_group","name":"Num","tab":"53b8c8f9.cfbe48","order":1,"disp":true,"width":"15","collapse":true},{"id":"53b8c8f9.cfbe48","type":"ui_tab","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...