kopia lustrzana https://github.com/blaz-r/pi_pico_neopixel
updated readme for RGB/RGBW order
rodzic
ef3af1a746
commit
cb63346324
|
@ -8,11 +8,13 @@ You'll first need to save the neopixel.py file to your device (for example, open
|
|||
You create an object with the parameters number of LEDs, state machine ID, GPIO number and mode (RGB or RGBW) in that order. So, to create a strip of 10 leds on state machine 0 and GPIO 0 in RGBW mode you use:
|
||||
|
||||
```
|
||||
from neopixel import neopixel
|
||||
from neopixel import Neopixel
|
||||
|
||||
pixels = neopixel(10, 0, 0, "RGBW")
|
||||
pixels = Neopixel(10, 0, 0, "RGBW")
|
||||
```
|
||||
|
||||
Mind that you can use whichever order of RGB / RGBW you want (GRB, WRGB, GRB, RGWB ...). This only represents order of data sent to led-strip, all functions still work with RGBW order. Exact order of leds should be on package of your led-strip. (My BTF-lights sk6812 has GRBW)
|
||||
|
||||
This class has many methods, two main ones being show() which sends the data to the strip, and set_pixel which sets the color values for a particular LED. The parameters are LED number and a tuple of form (red, green blue) or (red, green, blue, white) with the colors taking values between 0 and 255.
|
||||
|
||||
At the moment, this isn't working with the interpreter, so you have to run it from a file. Looks like it's running just too slow to keep up with the PIO buffer from the interpreter. The key methods are set_pixel(n (r,g,b)), set_pixel_line(p1, p2, (r, g, b)) which sets a row of pixels from pixel p1 to pixel p2 (inclusive), and fill((r,g,b)) which fills all the pixels with the color r, g, b.
|
||||
|
|
Ładowanie…
Reference in New Issue