LED control via GPIO on Raspberry Pi

Simple Node Red flow to control an LED connected to GPIO pin 4 on a Raspberry Pi. The other leg of the LED is connected to GND via a 220 Ohm resistor. Now with user interface using the dashboard which can be accessed by appending /ui to the host address.

[{"id":"3b7e96ace20a1b52","type":"tab","label":"LED control via GPIO","disabled":false,"info":"","env":[]},{"id":"2fe2ac8d2648777e","type":"rpi-gpio out","z":"3b7e96ace20a1b52","name":"LED","pin":"4","set":true,"level":"0","freq":"","out":"out","bcm":true,"x":570,"y":160,"wires":[]},{"id":"a99d6df7b183cef9","type":"inject","z":"3b7e96ace20a1b52","name":"LED On","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":100,"wires":[["c07977db8a86a5de","50c740ca8ba65657"]]},{"id":"3481fbe3b55a8f53","type":"inject","z":"3b7e96ace20a1b52","name":"LED Off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":220,"wires":[["c07977db8a86a5de","50c740ca8ba65657"]]},{"id":"c07977db8a86a5de","type":"debug","z":"3b7e96ace20a1b52","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":170,"y":160,"wires":[]},{"id":"9f1aed80ce0c6acf","type":"comment","z":"3b7e96ace20a1b52","name":"LED control via GPIO pin 4","info":"Simple flow to control an LED connected\nto GPIO pin 4 on a Raspberry Pi. The \nother leg of the LED is connected to\nGND via a 220 Ohm resistor.","x":510,"y":100,"wires":[]},{"id":"50c740ca8ba65657","type":"ui_switch","z":"3b7e96ace20a1b52","name":"","label":"OFF > ON","tooltip":"","group":"aeeb8e697c93dee8","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":390,"y":160,"wires":[["2fe2ac8d2648777e"]]},{"id":"b25f1345c0e776db","type":"comment","z":"3b7e96ace20a1b52","name":"To access Dashboard append /ui to host address","info":"","x":440,"y":220,"wires":[]},{"id":"aeeb8e697c93dee8","type":"ui_group","name":"LED on GPIO pin 4","tab":"d63127b860489ad8","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"d63127b860489ad8","type":"ui_tab","name":"GPIO Control Centre","icon":"dashboard","disabled":false,"hidden":false}]

Flow Info

Created 1 year, 9 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • comment (x2)
  • debug (x1)
  • inject (x2)
Other

Tags

  • led
  • switch
  • dashboard
  • ui
  • gpio
  • raspberrypi
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option