Skip to content

Instantly share code, notes, and snippets.

@SChinnaphat
Created June 21, 2017 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SChinnaphat/730ea668b11513baabcfd27e460f404e to your computer and use it in GitHub Desktop.
Save SChinnaphat/730ea668b11513baabcfd27e460f404e to your computer and use it in GitHub Desktop.
UI_Control_LED

Control bright level of LED & On-Off with switch

[{"id":"644936e0.a627c","type":"ui_slider","z":"1c0fcd1a.59ad53","tab":"970d711c.5a9948","name":"Slider","topic":"","group":"Control LED","order":"2","min":"0","max":10,"x":198,"y":71,"wires":[["277b2398.7ece34","51eb2d66.6df4ec","f5d9f552.efe358","6d336fd7.4ccaa8"]]},{"id":"277b2398.7ece34","type":"ui_gauge","z":"1c0fcd1a.59ad53","tab":"970d711c.5a9948","name":"Gauge","group":"Control LED","order":"3","format":"{{value}}","min":0,"max":10,"x":611,"y":159,"wires":[]},{"id":"51eb2d66.6df4ec","type":"ui_chart","z":"1c0fcd1a.59ad53","tab":"970d711c.5a9948","name":"","group":"Control LED","order":"4","interpolate":"linear","nodata":"No Data","removeOlder":1,"removeOlderUnit":"86400","x":611,"y":265,"wires":[[],[]]},{"id":"f5d9f552.efe358","type":"rpi-gpio out","z":"1c0fcd1a.59ad53","name":"LED","pin":"40","set":"","level":"0","out":"pwm","x":614,"y":81,"wires":[]},{"id":"51345861.ba0cf8","type":"function","z":"1c0fcd1a.59ad53","name":"Function","func":"if(msg.payload == \"true\"){\n msg.payload = 1;\n}\nelse{\n msg.payload = 0;\n} \nreturn msg;","outputs":"1","noerr":0,"x":416,"y":346,"wires":[["644936e0.a627c"]]},{"id":"4c7181e0.39bbc8","type":"ui_switch","z":"1c0fcd1a.59ad53","tab":"970d711c.5a9948","name":"Switch","topic":"","group":"Control LED","order":1,"onvalue":"true","offvalue":"false","x":181,"y":348,"wires":[["51345861.ba0cf8"]]},{"id":"6d336fd7.4ccaa8","type":"function","z":"1c0fcd1a.59ad53","name":"SetSwitch","func":"if(msg.payload > 0)\n msg.payload = 1;\nelse \n msg.payload = 0;\n \nreturn msg;\n","outputs":1,"noerr":0,"x":190,"y":221,"wires":[["4c7181e0.39bbc8"]]},{"id":"970d711c.5a9948","type":"ui_tab","z":"","name":"TEST1","icon":"dashboard","order":"1"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment