diff --git a/duckyinpython.py b/duckyinpython.py index a0a6087..96a2a4e 100644 --- a/duckyinpython.py +++ b/duckyinpython.py @@ -97,6 +97,19 @@ def parseLine(line): led.value = False else: led.value = True + elif(line[0:21] == "WAIT_FOR_BUTTON_PRESS"): + button_pressed = False + # NOTE: we don't use assincio in this case because we want to block code execution + while not button_pressed: + button1.update() + + button1Pushed = button1.fell + button1Released = button1.rose + button1Held = not button1.value + + if(button1Pushed): + print("Button 1 pushed") + button_pressed = True else: newScriptLine = convertLine(line) runScriptLine(newScriptLine)