Starting without switch


Hi i am using node-red first time
i simply just wanna on off led
as much i read about that i did same
but i did not find any result ,


i took a inject node
payload =string=1
Topic=off

other i took
rpi.gpio.out
my pin is gpio 3
so i slected SCL1-GPIO03-5
ouput=Digital
instate=1(High)


So No result as i understand while deploying it has to light up because i put it in instate=1.
and and then i will make another inject off 0 to off that
and for 1(on) i already have.

CODE TO IMPORT**
[{"id":"15cf5244.2443ee","type":"rpi-gpio out","z":"91d7e374.caa48","name":"ON","pin":"5","set":true,"level":"1","freq":"","out":"out","x":570,"y":240,"wires":[]}]

Hi and welcome to the forum, Please put three backticks on a line above and below your code to mark it as a code block otherwise the forum screws it up (un importable)

```
like this
```

1 Like

So do you know if your LED turns on/off when changed from the command line? Always best with hardware control to try the simplest approach first. Once you know for sure that the hardware control is actually working, you can move on to the more flexible control from Node-RED.

yes i tried first from commands & from that it is working.But from node-red it is not.
Is my flow is not right.What i have to do.

You are talking hardware. Though LED kind of implies that, there is an LED node.

One thing you may be failing on is how you connect the LED.

I believe the practice is to connect the LED anode to + (via resistor) and connect the cathode to the GPIO pin.

This way the RasPi sinks the current.

If you wired it up so the anode goes to the GPIO pin and the cathode to the GND, it won't work as expected.

Another thing - maybe academic - but what you are injecting:
payload = string = 1.
Probably better if you make that a number rather than string.
Strings of 1 and 0 don't exactly equate to high and low on the GPIO pins.

true and false could also be used but I am not too sure on how that translates via the GPIO node.
(rpi.gpio.out I think is the node you are using)

1 Like

Make a flow with two inject nodes and the gpio node that shows the problem and post it here using the technique noted above.

Also, please, in a terminal run

node-red-stop
node-red-start

Exercise the inject nodes and copy/paste the full output here. That may tell us something useful.

1 Like

But No result.

nd3
nd4

i tried with resistor also but not working.from terminal it working perfectly.
i am not understanding why that nuch small thing is not happening.
it seems me like it is not getting connected from RPI3. Besides node-red is running properly

yes it it working from terminal perfectly
but from node-red i don't know it is approaching rpi3 or not because if it was approaching it should definitely work.

Thanks i will do that sure

Can you post your terminal code that works please?

sure
gpio mode 3 out gpio write 3 1 gpio write 3 0
1 for High
0 for Low

Also, as I suggested, connect another inject node injecting 0 in case the logic is inverted.

Also as I asked please post the startup log up including clicking the two inject buttons.

Sorry but
where i can find startup log?
or is it about debugging log?


is we wrere talking about that

Is that using wiring pi library?

Is your LED connected to physical pin number 3 (the one marked SDA1 - GPIO2 -3) ?

1 Like

As I suggested previously, run

node-red-stop
node-red-start

That will restart node red and show the startup log in the terminal