WS2811B RGB LED RPi: Unterschied zwischen den Versionen

Aus AirSpaceWatch & More
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „<syntaxhighlight lang="bash" line='line'> import time import board import neopixel pixels = neopixel.NeoPixel(board.D18, 4) #4 PIXEL #time.sleep(1) #pixels[0]…“)
 
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
<syntaxhighlight lang="bash" line='line'>
 
<syntaxhighlight lang="bash" line='line'>
 +
# deps, needs root for peripherals:
 +
# python3 -m pip install --force-reinstall rpi_ws281x adafruit-circuitpython-neopixel
 +
# python3 -m pip install --force-reinstall adafruit-blinka
 
import time
 
import time
 
import board
 
import board
Zeile 15: Zeile 18:
 
         pixels[x] = (50, 0, 0)
 
         pixels[x] = (50, 0, 0)
 
         time.sleep(0.2)
 
         time.sleep(0.2)
<syntaxhighlight>
+
</syntaxhighlight>

Aktuelle Version vom 14. Januar 2021, 10:48 Uhr

 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)