blink a single LED on the SAM32 when D36 is pulled to ground

⚙ Hardware Needed


📚 External Libraries Needed


None

📑 Code


import board
from digitalio import DigitalInOut, Direction, Pull

led = DigitalInOut(board.LED)
led.direction = Direction.OUTPUT

switch = DigitalInOut(board.D36)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

while True:
    led.value = not switch.value
    time.sleep(0.01)