/ NeoPixel_Gemma_Torch / code.py
code.py
1 # SPDX-FileCopyrightText: 2020 Noe Ruiz for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import board 6 import neopixel 7 import adafruit_dotstar 8 9 LED = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1) #Setup Internal Dotar 10 LED.brightness = 0.8 #DotStar brightness 11 12 NUMPIX = 7 # Number of NeoPixels 13 PIXPIN = board.D2 # Pin where NeoPixels are connected 14 PIXELS = neopixel.NeoPixel(PIXPIN, NUMPIX) # NeoPixel object setup 15 16 RED = 7 #Number of pixels to be red 17 BLUE = 0 #First pixel 18 19 while True: # Loop forever... 20 #Make the internal dotstar light up. 21 LED[0] = (100, 0, 255) 22 23 #Select these pixels starting with the second pixel. 24 for i in range(1, RED): 25 # Make the pixels red 26 PIXELS[i] = (100, 0, 0) 27 28 #Make the first neopixel this color 29 PIXELS[BLUE] = (0, 0, 100)