场景
Node-RED简介与Windows上安装、启动和运行示例:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/121884766
在inject节点可以设置重复触发的周期性事件。
比如每两秒输出一次时间。
注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。
实现
1、周期性执行
json示例数据
[{"id":"71107f63.c2686","type":"inject","z":"f8f370d9.7ccc3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":280,"wires":[["6866ece6.3b1964"]]},{"id":"6866ece6.3b1964","type":"debug","z":"f8f370d9.7ccc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":420,"y":300,"wires":[]}]
2、指定时间阶段周期性执行
json数据
[{"id":"2ee46c27fe222be5","type":"inject","z":"4bc32962b964d23d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/1 0 * * 1,3,5","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":190,"y":360,"wires":[["26092280afbca76a"]]},{"id":"26092280afbca76a","type":"debug","z":"4bc32962b964d23d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":400,"y":380,"wires":[]}]
3、指定时间执行
json数据
[{"id":"9e4a370a93991fdc","type":"inject","z":"4bc32962b964d23d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * 1","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":190,"y":500,"wires":[["4af3067548fcc9f6"]]},{"id":"4af3067548fcc9f6","type":"debug","z":"4bc32962b964d23d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":380,"y":540,"wires":[]}]
博客园:
https://www.cnblogs.com/badaoliumangqizhi/
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。