Skip to content

Instantly share code, notes, and snippets.

@lesp
Created June 7, 2018 08:42
Show Gist options
  • Save lesp/dcf6485c9e45bf41ed2ac74456ba99db to your computer and use it in GitHub Desktop.
Save lesp/dcf6485c9e45bf41ed2ac74456ba99db to your computer and use it in GitHub Desktop.
code.py from Gemma M0, code waits for button press to print FIRE in the REPL
# CircuitPython IO demo #1 - General Purpose I/O
import time
import board
from digitalio import DigitalInOut, Direction, Pull
switch = DigitalInOut(board.D2)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
while True:
if switch.value:
print("Waiting")
time.sleep(0.1)
else:
print("FIRE")
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment