# Starting without switch

**URL:** <https://discourse.nodered.org/t/starting-without-switch/22385>\
**Category:** General\
**Created:** [28 February 2020 19:51 UTC](https://discourse.nodered.org/t/starting-without-switch/22385 "2020-02-28T19:51:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [28 February 2020 19:51 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/1 "2020-02-28T19:51:38Z")

</div>

* * *

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":[]}]` ` `

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 February 2020 20:33 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/2 "2020-02-28T20:33:28Z")

</div>

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`  
`````

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 February 2020 20:37 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/3 "2020-02-28T20:37:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 07:18 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/4 "2020-02-29T07:18:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [29 February 2020 08:05 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/5 "2020-02-29T08:05:08Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 February 2020 08:08 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/6 "2020-02-29T08:08:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 February 2020 09:23 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/7 "2020-02-29T09:23:39Z")

</div>

Also, please, in a terminal run

```auto
node-red-stop
node-red-start

```

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

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 10:07 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/8 "2020-02-29T10:07:27Z")

</div>

![nd1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b31d752fca6188abb242a65d40b7f6a6829bec7.png)

But No result.

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 10:13 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/9 "2020-02-29T10:13:52Z")

</div>

![nd3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae4c8d69229f0295a810ec1a188ad20e233f0a85.png)  
 ![nd4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/07b36b421a248a228e688f4c5f79f2b0aea302db.png)

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 10:23 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/10 "2020-02-29T10:23:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 10:25 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/11 "2020-02-29T10:25:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 10:27 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/12 "2020-02-29T10:27:30Z")

</div>

Thanks i will do that sure

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 February 2020 11:12 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/13 "2020-02-29T11:12:11Z")

</div>

Can you post your terminal code that works please?

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 11:17 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/14 "2020-02-29T11:17:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 February 2020 11:18 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/15 "2020-02-29T11:18:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 February 2020 11:20 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/16 "2020-02-29T11:20:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 11:25 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/17 "2020-02-29T11:25:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anurag](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Anurag](https://discourse.nodered.org/u/Anurag)\
**Post date:** [29 February 2020 11:26 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/18 "2020-02-29T11:26:17Z")

</div>

![fn](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb2ce96cd1ee0016d1605da85abe06a93e78b91c.png)  
is we wrere talking about that

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 February 2020 11:33 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/19 "2020-02-29T11:33:48Z")

</div>

> [@Anurag](#):
>
> gpio mode 3 out

Is that using wiring pi library?

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 February 2020 11:38 UTC](https://discourse.nodered.org/t/starting-without-switch/22385/20 "2020-02-29T11:38:48Z")

</div>

> [@Anurag](#):
>
> where i can find startup log

As I suggested previously, run

```auto
node-red-stop
node-red-start

```

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

[Next page](https://discourse.nodered.org/t/starting-without-switch/22385.md?page=2)
