Skip to content

Instantly share code, notes, and snippets.

@Neradoc
Last active July 12, 2023 07:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neradoc/8056725be1c209475fd09ffc37c9fad4 to your computer and use it in GitHub Desktop.
Save Neradoc/8056725be1c209475fd09ffc37c9fad4 to your computer and use it in GitHub Desktop.
boot.py implementing waiting to start into safe mode on Raspberry pico
import board
import time
from digitalio import DigitalInOut,Pull
led = DigitalInOut(board.LED)
led.switch_to_output()
safe = DigitalInOut(board.GP14) # <----- choose your pin with a button on it
safe.switch_to_input(Pull.UP)
def reset_on_pin():
if safe.value is False:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)
microcontroller.reset()
led.value = False
for x in range(16):
reset_on_pin()
led.value = not led.value
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment