Skip to content

Instantly share code, notes, and snippets.

@pingswept
Created November 1, 2022 13:28
Show Gist options
  • Save pingswept/ac15331855802ce5dd212f8050fcee3c to your computer and use it in GitHub Desktop.
Save pingswept/ac15331855802ce5dd212f8050fcee3c to your computer and use it in GitHub Desktop.
import board
import digitalio as dio
import time
led = dio.DigitalInOut(board.LED)
led.direction = dio.Direction.OUTPUT
button = dio.DigitalInOut(board.D6)
button.direction = dio.Direction.INPUT
other_led = dio.DigitalInOut(board.D5)
other_led.direction = dio.Direction.OUTPUT
led.value = False
while True:
if led.value is True:
led.value = False
else:
led.value = True
time.sleep(1.0)
if button.value is True:
other_led.value = True
else:
other_led.value = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment