code.py
1 # SPDX-FileCopyrightText: 2017 Phillip Burgess for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import time 6 from rainbowio import colorwheel 7 import board 8 import neopixel 9 10 numpix = 5 # Number of NeoPixels 11 pixpin = board.D1 # Pin where NeoPixels are connected 12 hue = 0 # Starting color 13 strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.4) 14 15 while True: # Loop forever... 16 for i in range(numpix): 17 strip[i] = colorwheel((hue + i * 8) & 255) 18 strip.write() 19 time.sleep(0.02) # 20 ms = ~50 fps 20 hue = (hue + 1) & 255 # Increment hue and 'wrap around' at 255