dbisu / pico-ducky

Create a USB Rubber Ducky like device using a Raspberry PI Pico
GNU General Public License v2.0
2.43k stars 440 forks source link

Add button to run scripts #92

Closed dbisu closed 2 years ago

TheExpertNoob commented 2 years ago

Emulation doesn't like it. https://wokwi.com/projects/341529874106679891 Also, wouldn't this now REQUIRE the button to be installed on GP22 <-> GND for it to actually execute?

TheExpertNoob commented 2 years ago

from adafruit_debouncer import Debouncer

as well as

#init button
button1_pin = digitalio.DigitalInOut(GP22) #defaults to input
button1_pin.switch_to_input(pull=digitalio.Pull.UP) #turn on internal pull-up resistor
button1 =  Debouncer(button1_pin)

seem to fix emulation errors. (will also need to add the adafruit_debouncer module to lib folder)

dbisu commented 2 years ago

I created a new PR that fixes these issues. I was in a hurry and didn't do go testing before merging the previous PR.

The script will still run like normal. This just gives an option to push a script while in "programming" mode. So if you don't want a script to fire automatically, leave the pico in programming mode and then use the button to fire the script.