/ CircuitPython_Heart_Sculpture / code.py
code.py
1 # SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import time 6 import adafruit_dotstar 7 from rainbowio import colorwheel 8 import board 9 import touchio 10 11 pixel = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=.1) 12 13 touch = touchio.TouchIn(board.D1) 14 15 hue = 0 16 while True: 17 hue = hue + touch.value * 3 18 if hue > 255: # Wrap back around to red 19 hue = hue - 255 20 pixel[0] = colorwheel(hue) 21 time.sleep(.05)