Update code.py
Change from using neopixel_spi to neopixel
# Demo code to generate an alternating color-gradient effect in
-# the QT Py LED cuff bracelet
+# the QT Py LED cuff bracelet LEDs.
import time
import board
-import neopixel_spi as neopixel
+import neopixel
# Total number of LEDs on both strips
NUM_PIXELS = 14
-# Using the neopixel_spi library because the LED strip signal uses the SPI bus. It
-# would work just as well with the standard neopixel library. This particular code
-# As written, this code doesnt require the faster speed of SPI, but it may prove useful
-# if additional functionality is added, e.g. reading and responding to sensor inputs
-spi = board.SPI()
-pixels = neopixel.NeoPixel_SPI(
- spi, NUM_PIXELS, pixel_order=neopixel.GRB, auto_write=False, brightness = 0.4
+pixels = neopixel.NeoPixel(board.MOSI, NUM_PIXELS, pixel_order=neopixel.GRB, auto_write=False, brightness = 0.4
)
def wheel(pos):
@@ -43,7 +37,7 @@ def oppositeHue(x):
hueIndex = 0 # determines hue value (0->255)
brightnessIndex = 0 # input to the sawtooth function for determining brightness (0->255)
-brightnessSpeed = 3 #bigger value = faster shifts in brightness n
+brightnessSpeed = 3 # bigger value = faster shifts in brightness
while True:
bright = sawtooth(brightnessIndex)
