code.py
1 # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 # SPDX-License-Identifier: MIT 3 """ 4 CircuitPython DotStar red, green, blue, brightness control example. 5 """ 6 import time 7 import board 8 from rainbowio import colorwheel 9 import adafruit_dotstar 10 11 dot = adafruit_dotstar.DotStar(board.DOTSTAR_CLOCK, board.DOTSTAR_DATA, 1) 12 dot.brightness = 0.3 13 14 15 def rainbow(delay): 16 for color_value in range(255): 17 dot[0] = colorwheel(color_value) 18 time.sleep(delay) 19 20 21 while True: 22 rainbow(0.02)