Once you've gone through the setup specific to your hardware, you should be able to run this example code on any of them.
This example was written for the 12 pixel RGB NeoPixel ring shown in the wiring diagrams. To use with other NeoPixel products, change NUM_PIXELS and PIXEL_ORDER to match your setup. You can also change or add colors to the COLORS tuple and change the speed via DELAY.
If you are using the FT232H, don't forget to set the BLINKA_FT232H environment variable.
Save this as neo_ring.py:
import time import board import neopixel_spi as neopixel NUM_PIXELS = 12 PIXEL_ORDER = neopixel.GRB COLORS = (0xFF0000, 0x00FF00, 0x0000FF) DELAY = 0.1 spi = board.SPI() pixels = neopixel.NeoPixel_SPI(spi, NUM_PIXELS, pixel_order=PIXEL_ORDER, auto_write=False) while True: for color in COLORS: for i in range(NUM_PIXELS): pixels[i] = color pixels.show() time.sleep(DELAY) pixels.fill(0)
Page last edited March 08, 2024
Text editor powered by tinymce.