code.py
1 # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 """Touch each pad to change red, green, and blue values on the LED""" 6 import time 7 8 import adafruit_dotstar 9 import board 10 import touchio 11 12 led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1) 13 touch_A0 = touchio.TouchIn(board.A0) 14 touch_A1 = touchio.TouchIn(board.A1) 15 touch_A2 = touchio.TouchIn(board.A2) 16 17 r = g = b = 0 18 19 while True: 20 if touch_A0.value: 21 r = (r + 1) % 256 22 if touch_A1.value: 23 g = (g + 1) % 256 24 if touch_A2.value: 25 b = (b + 1) % 256 26 27 led[0] = (r, g, b) 28 print((r, g, b)) 29 time.sleep(0.01)