-
Notifications
You must be signed in to change notification settings - Fork 0
2 16 Program Examples
Joseph Freeston edited this page Feb 16, 2023
·
1 revision
Fix any permissions issues, etc. by erasing all memory:
import storage
storage.erase_filesystem()
Hello World!
print("Hello World!")
Turn on Neopixel:
import board
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixel.fill((255, 255, 255))
Blink Neopixel:
import time
import board
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixel.brightness = 0.3
while True:
pixel.fill((255, 0, 0))
time.sleep(0.5)
pixel.fill((0, 255, 0))
time.sleep(0.5)
pixel.fill((0, 0, 255))
time.sleep(0.5)
Capacitive Touch Input
import time
import board
import touchio
touch = touchio.TouchIn(board.D8)
while True:
if touch.value:
print("Pin touched!")
time.sleep(0.1)
Copyright 2022-2023 Heather Brayer, Joseph R. Freeston, & Lucas Tousignant