first test
This commit is contained in:
parent
f22327bd12
commit
e083ca6185
1 changed files with 21 additions and 0 deletions
21
Introducing_Gemma_M0/Gemma_DigitalIO.py
Normal file
21
Introducing_Gemma_M0/Gemma_DigitalIO.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Gemma IO demo #1 - General Purpose I/O
|
||||
|
||||
from digitalio import DigitalInOut, Direction, Pull
|
||||
import board
|
||||
import time
|
||||
|
||||
led = DigitalInOut(board.D13)
|
||||
led.direction = Direction.OUTPUT
|
||||
|
||||
button = DigitalInOut(board.D1)
|
||||
button.direction = Direction.INPUT
|
||||
button.pull = Pull.UP
|
||||
|
||||
while True:
|
||||
# we could also just do "led.value = not button.value" !
|
||||
if button.value:
|
||||
led.value = False
|
||||
else:
|
||||
led.value = True
|
||||
|
||||
time.sleep(0.01) # debounce delay
|
||||
Loading…
Reference in a new issue