hi there,
i have a Display connected I2C and there is a button configured to turn on the Display for 5 seconds, i am wondering if there is a way that i can turn an LED connected to GPIO 5 when the Display is turned on and turn the LED of after the LCD turn off ?
thanks
Turning LED on and off based on LCD status
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 10
- Joined: 11 Sep 2016, 16:43
-
- Normal user
- Posts: 10
- Joined: 11 Sep 2016, 16:43
Re: Turning LED on and off based on LCD status
Ok, i found a solution
I found that if I create a device with a SWITCH input type for the GPIO connected to Display on/off button (in my case the button is connected to GPIO 4) I can use it in rules based on its state
now my rule is like this:
on s1#switch do
gpio,5,1
timerSet,1,4
endon
On Rules#Timer=1 do
gpio,5,0
endon
my next step is that i want to replace the physical button with a touch sensor KY036, and hopefully when i touch the face-plate of the screen it turns on along with illuminating buttons
any ideas ?
I found that if I create a device with a SWITCH input type for the GPIO connected to Display on/off button (in my case the button is connected to GPIO 4) I can use it in rules based on its state
now my rule is like this:
on s1#switch do
gpio,5,1
timerSet,1,4
endon
On Rules#Timer=1 do
gpio,5,0
endon
my next step is that i want to replace the physical button with a touch sensor KY036, and hopefully when i touch the face-plate of the screen it turns on along with illuminating buttons
any ideas ?

-
- Normal user
- Posts: 10
- Joined: 11 Sep 2016, 16:43
Re: Turning LED on and off based on LCD status
Well, now everything is working as i want, i connected the KY036 touch sensor to GPIO 4, and configured a new device as a Switch type "Push Button Active Low", and then i modified my rule to be :
on s1#switch do
gpio,5,1
lcdcmd,on
timerSet,1,10 //Set Timer 1 for the next event in 4 seconds
endon
On Rules#Timer=1 do //When Timer1 expires, do
gpio,5,0
lcdcmd,off
endon
now when i touch the sensor, both LED and Display turn on for the time i define in the timerset 1
on s1#switch do
gpio,5,1
lcdcmd,on
timerSet,1,10 //Set Timer 1 for the next event in 4 seconds
endon
On Rules#Timer=1 do //When Timer1 expires, do
gpio,5,0
lcdcmd,off
endon
now when i touch the sensor, both LED and Display turn on for the time i define in the timerset 1
Who is online
Users browsing this forum: Ahrefs [Bot] and 11 guests