Page 1 of 1

Simple switch issues

Posted: 07 Jan 2017, 17:09
by hugo11
hi all,

I'm trying to use a simple pushbutton to turn a LED on locally for testing purposes but having hard times achieving it.

I have a LED connected to gpio 12 and a push button on pgio 16. I already tried a lot of combinations of the switch configuration but still struggling. (tried both bringing the pin high, low, pullup on/off).

Could someone help me with this?


Ultimately I'd like to send a http command when the gpio 16 will go high due to PIR activation.

The rules I have now for testing are :

on switchon do
gpio 12,1
endon

on switchoff do
gpio 12,0
endon

on test#Switch do
if [test#Switch]=1
event switchon
else
event switchoff
endif
endon

Re: Simple switch issues

Posted: 07 Jan 2017, 17:13
by iron
Here is your answer :

viewtopic.php?f=6&t=2039&start=10

Re: Simple switch issues

Posted: 07 Jan 2017, 17:36
by hugo11
Thanks a lot, I've seen similar topics to that based on which I also built the rules.

I'm still struggling, I think the issue is with triggering the switch on gpio 16. What I have not is a pushbutton soldered to ground, effectively grounding GPIO16 when I push the button, still the switch is still high.

Any ideas?

Re: Simple switch issues

Posted: 07 Jan 2017, 17:49
by iron
What ESP module are you on ?

Re: Simple switch issues

Posted: 07 Jan 2017, 20:10
by hugo11
I'm on ESP12E.
ok, eventually got it working.

The rule is as simple as this:

on Lightswitch#value do
SendToHTTP 192.168.2.4,39989,/cmd?a=motion_esp05_1
endon

The Switch is configured as pullup / reversed / push button active high and the gpio is connected to a PIR sensor. working absolutely fine for now.