WS2811B RGB LED RPi

Aus AirSpaceWatch & More
Zur Navigation springen Zur Suche springen
 1 # deps, needs root for peripherals:
 2 # python3 -m pip install --force-reinstall rpi_ws281x adafruit-circuitpython-neopixel
 3 # python3 -m pip install --force-reinstall adafruit-blinka
 4 import time
 5 import board
 6 import neopixel
 7 pixels = neopixel.NeoPixel(board.D18, 4) #4 PIXEL
 8 #time.sleep(1)
 9 #pixels[0] = (200, 0, 0)
10 #time.sleep(1)
11 while (1):
12     time.sleep(0.5)
13     for x in range(0, 4):
14         pixels[x] = (10, 10, 10)
15         time.sleep(0.2)
16     for x in range(0, 4):
17         pixels[x] = (50, 0, 0)
18         time.sleep(0.2)