Created
August 24, 2021 10:21
-
-
Save kisst/6156a6df95f6f3b9cc4139f65fd9c141 to your computer and use it in GitHub Desktop.
rpi pico circuitpython demo
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
import board | |
import digitalio | |
import time | |
led = digitalio.DigitalInOut(board.GP25) | |
led.direction = digitalio.Direction.OUTPUT | |
def blink(count=1, delay=0.5): | |
for cv in range(count): | |
led.value = True | |
time.sleep(delay) | |
led.value = False | |
time.sleep(delay) | |
diff = 1 | |
cv = 1 | |
while True: | |
blink(2, 1/cv) | |
cv = cv + diff | |
if (cv == 1 and diff == -1) or ( cv == 60 and diff == 1): | |
diff = diff * -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment