Vous trouverez ci-dessous les instructions en Python pour initialiser le bandeau de leds NeoPixel sous RapsberryPi :
from rpi_ws281x import *
LED_COUNT = 8 # Number of LED pixels.
LED_PIN = 12 # GPIO pin connected to the pixels (18 uses PWM!). (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0 # set to ‘1’ for GPIOs 13, 19, 41, 45 or 53
io.setmode ( io.BCM )
io.setwarnings ( False )
# Intialize the library (must be called once before other functions).
neopix = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
neopix.begin()
niv_rouge = 65
niv_vert = 35
niv_bleue = 75
neopix.setPixelColor(0, Color(niv_rouge, niv_vert, niv_bleue))
neopix.show()
for i in range(8): # Eteindre les neopixels
neopix.setPixelColor(i, Color(0, 0, 0))
neopix.show()
io.cleanup()