2 Switch, 1 LED blink and light
Posted: 10 May 2020, 10:08
Hallo, I have two switches on GPIO2 (SW1) and GPIO14(SW2) and I have a LED on GPIO 13.
The two switches can never pushed parallel due to the hardware!
Now I want to have it like this.
If SW1 is pushed and SW2 is not pushed then the LED should be off
If SW1 is not pushed an SW2 is not pushed the LED should blink
If SW2 is pushed and SW1 not pused the LED sould light without blinking
This is my code, but it´s not working:
if SW1 is pushed and SW2 is off the led is off
if SW1 is off and SW2 is off the led is blinking
but if SW2 is pushed and SW1 is off the led is blinking some times or off
I do not know why it´s not working.
The two switches can never pushed parallel due to the hardware!
Now I want to have it like this.
If SW1 is pushed and SW2 is not pushed then the LED should be off
If SW1 is not pushed an SW2 is not pushed the LED should blink
If SW2 is pushed and SW1 not pused the LED sould light without blinking
This is my code, but it´s not working:
if SW1 is pushed and SW2 is off the led is off
if SW1 is off and SW2 is off the led is blinking
but if SW2 is pushed and SW1 is off the led is blinking some times or off
Code: Select all
On garage_close#Value=0 do
//blink
timerSet,1,1
endon
On garage_close#Value=1 do
//stop blinking
timerSet,1,0
endon
On garage_open#Value=0 do
//switch off led and blink
GPIO,13,0
timerSet,1,1
endon
//wenn geschlossen aus
On garage_open#Value=1 do
//switch off blink and light
timerSet,1,0
GPIO,13,1
endon
//create an actual warning signal, every time
timer 1 expires:
On Rules#Timer=1 do
//repeat after 2 seconds
timerSet,1,1
//pulse some led on pin 4 shortly
Pulse,13,1,200
endon