neopixel_pixel.py
1 # This example shows how to create a single pixel with a specific color channel 2 # order and blink it. 3 # Most NeoPixels = neopixel.GRB or neopixel.GRBW 4 # The 8mm Diffused NeoPixel (PID 1734) = neopixel.RGB 5 import time 6 import board 7 import neopixel 8 9 # Configure the setup 10 PIXEL_PIN = board.D1 # pin that the NeoPixel is connected to 11 ORDER = neopixel.RGB # pixel color channel order 12 COLOR = (100, 50, 150) # color to blink 13 CLEAR = (0, 0, 0) # clear (or second color) 14 DELAY = 0.25 # blink rate in seconds 15 16 # Create the NeoPixel object 17 pixel = neopixel.NeoPixel(PIXEL_PIN, 1, pixel_order=ORDER) 18 19 # Loop forever and blink the color 20 while True: 21 pixel[0] = COLOR 22 time.sleep(DELAY) 23 pixel[0] = CLEAR 24 time.sleep(DELAY)