mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Add button to run scripts (#92)
This commit is contained in:
@@ -128,6 +128,11 @@ time.sleep(.5)
|
|||||||
|
|
||||||
led_pwm_up(led)
|
led_pwm_up(led)
|
||||||
|
|
||||||
|
#init button
|
||||||
|
button1_pin = DigitalInOut(board.IO22) # defaults to input
|
||||||
|
button1_pin.pull = Pull.UP # turn on internal pull-up resistor
|
||||||
|
button1 = Debouncer(button1_pin)
|
||||||
|
|
||||||
def getProgrammingStatus():
|
def getProgrammingStatus():
|
||||||
# check GP0 for setup mode
|
# check GP0 for setup mode
|
||||||
# see setup mode for instructions
|
# see setup mode for instructions
|
||||||
@@ -216,10 +221,15 @@ else:
|
|||||||
|
|
||||||
led_state = False
|
led_state = False
|
||||||
while True:
|
while True:
|
||||||
|
button1.update()
|
||||||
|
button1Pushed = button1.fell
|
||||||
|
if(button1Pushed):
|
||||||
|
runScript(payload)
|
||||||
|
button1Pushed = False
|
||||||
|
|
||||||
if led_state:
|
if led_state:
|
||||||
led_pwm_up(led)
|
led_pwm_up(led)
|
||||||
led_state = False
|
led_state = False
|
||||||
else:
|
else:
|
||||||
led_pwm_down(led)
|
led_pwm_down(led)
|
||||||
led_state = True
|
led_state = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user