Created
June 7, 2018 08:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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