Beginner - button on web page to control relay


I am new to Node-Red. I have a relay attached to a Pi using GPIO, pin 26. I am trying to create a basic web page (UI) with a button, that when pressed, sends a '1' to the relay turning it on, then when the button is released, sends a '0'. This seems like a very basic function (think of car horn). My difficulty is understanding the assembly. I've installed two UI palettes, found the button, but don't understand payload and sending '1' or '0' via the button. I can manually use inject to send a '1' or '0' to the relay, but this momentary button setup is confusing me. I would appreciate any thoughts on creating this momentary button with web ui. I've tried importing code, but then I get errors around missing groups, etc. and can't seem to find the palette used. :neutral_face:

Thank you for your help! -Henry


Mostly multiple dashboards installations will not work. You'll have to choose one. And uninstall the other.
For beginner I'd suggest to choose node-red-dashboard as you will get help from many users as it is more commonly used.
Then do again search about momentary button, there is many examples and working solutions shared.

Thank you for the dashboard suggestion--this got me going. Thank you!

1 Like

Here's a link to a tutorial I wrote for my IoT students.
It shows how to create buttons with different actions.
e.g. On and Off, toggle, reset, etc..

Hope you find it useful.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.