Simple "library" that makes it easy to use LED strings and rings (WS2812 ones) with Raspberry pi PICO You can only run one instance of led object at a time, so there is no need for this to behave like an object Furthere more this standard is very performace heavy (for PICO)
So...
- Turn off your PICO
- Connect your leds to PICO and led string (power, ground, data), now it's safe to turn on
- Download the file and include it in your script
- You'r ready to go now... if you only knew how to use it :)
To use the library you MUST set up output pin and number of leds on your ring/string, you can find those variales at the top of the script:
NUM_LEDS = 21
#sets the pin 21 as the output pinPIN_NUM = 8
#sets the number of led's on a string to 8
Additionaly you can change the brightness of the led's (not mandatory)
set_brightnes(0.5)
#sets the brightness to half of the max value
-
Fill the values in the array You can do it one by one:
pixels_set(n, color)
#where n is the number if pixel and color is well... color in rgb (r, g, b) with numbers up to 255Or you can fill all in one go
pixels_fill(color)
#where color is the color you'll fill the led's with -
Send that data to your led's To do this you only need to type one simple line:
pixels_show()
-
Clear the pixels at the end:
clear_display()
#just clears the led's, good to use at the end
- color chase effect:
color_chase(color, time)
#where color stands for RGB color, and time stands for transition time in seconds - rainbow cycle effect
rainbow_cycle(time)
#where time stands for transition time in seconds - some basic colors:
BLACK, RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE, WHITE
feel free to add your own!