Adafruit_Learning_System_Gu.../CircuitPython_Heart_Sculpture/code.py
2022-02-23 13:49:59 -05:00

21 lines
494 B
Python

# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import adafruit_dotstar
from rainbowio import colorwheel
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] = colorwheel(hue)
time.sleep(.05)