code for new guide
This commit is contained in:
parent
be91a9df3e
commit
1e56735291
1 changed files with 17 additions and 0 deletions
17
CircuitPython_Heart_Sculpture/code.py
Normal file
17
CircuitPython_Heart_Sculpture/code.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import time
|
||||
import adafruit_dotstar
|
||||
import adafruit_pypixelbuf
|
||||
import board
|
||||
import touchio
|
||||
|
||||
pixel = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=.1)
|
||||
|
||||
touch = touchio.TouchIn(board.D1)
|
||||
|
||||
hue = 0
|
||||
while True:
|
||||
hue = hue + touch.value * 3
|
||||
if hue > 255: # Wrap back around to red
|
||||
hue = hue - 255
|
||||
pixel[0] = adafruit_pypixelbuf.colorwheel(hue)
|
||||
time.sleep(.05)
|
||||
Loading…
Reference in a new issue