Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4966

Beginners • LED turned on by one script, need "reset" button to turn it off

$
0
0
I am using Tasker to send an SSH message to a RasPi when I get a message. That script turns on an LED so I can see that I missed an incoming text message. I would like to have a physical GPIO button turn the LED off but haven't found a way. Here's what I have tried, which should be the easiest:

Code:

from gpiozero import LED, Buttonfrom signal import pauseled = LED(20)button = Button(7)button.when_pressed = led.offpause()
I am sure of my connections. I have confirmed that the switch is open when released and closed when pressed. Is the LED staying on because a different script turned it on?

Statistics: Posted by duckredbeard — Wed Dec 11, 2024 2:13 pm



Viewing all articles
Browse latest Browse all 4966

Trending Articles