场景

Node-RED简介与Windows上安装、启动和运行示例:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/121884766

Node-RED的range范围节点可以将值从一个范围对应另一个范围。

比如将值从0-1023对应输出成0-255

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

1、range节点的编辑

 

 

2、json数据

[{"id":"8286efb9.83b27","type":"inject","z":"34d4d5aa.c0d0ea","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":210,"y":300,"wires":[["6fa78e43.150d3"]]},{"id":"cdc22ced.16646","type":"inject","z":"34d4d5aa.c0d0ea","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"512","payloadType":"num","x":210,"y":360,"wires":[["6fa78e43.150d3"]]},{"id":"8327df99.434ed","type":"inject","z":"34d4d5aa.c0d0ea","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1023","payloadType":"num","x":210,"y":420,"wires":[["6fa78e43.150d3"]]},{"id":"6fa78e43.150d3","type":"range","z":"34d4d5aa.c0d0ea","minin":"0","maxin":"1023","minout":"0","maxout":"255","action":"scale","round":true,"property":"payload","name":"Map","x":410,"y":360,"wires":[["6339d720.10a758"]]},{"id":"6339d720.10a758","type":"debug","z":"34d4d5aa.c0d0ea","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":360,"wires":[]}]

 

posted on 2022-04-13 21:41  霸道流氓  阅读(115)  评论(0编辑  收藏  举报