tweak
This commit is contained in:
parent
66bc040ba8
commit
dbec42e381
4
main.py
4
main.py
@ -1,6 +1,7 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
|
import asyncio
|
||||||
|
|
||||||
def button_press(pin:int):
|
async def button_press(pin:int):
|
||||||
def button_callback(channel):
|
def button_callback(channel):
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
return True
|
return True
|
||||||
@ -11,6 +12,7 @@ def button_press(pin:int):
|
|||||||
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
||||||
GPIO.add_event_detect(pin,GPIO.RISING,callback=button_callback)
|
GPIO.add_event_detect(pin,GPIO.RISING,callback=button_callback)
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
|
asyncio.sleep(5)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user