All Projects → blaz-r → pi_pico_neopixel

blaz-r / pi_pico_neopixel

Licence: MIT License
Pi Pico library for NeoPixel led-strip written in MicroPython. Works with ws2812b (RGB) and sk6812 (RGBW).

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pi pico neopixel

ioBroker.wled
IoBroker integration to WLED project
Stars: ✭ 22 (-68.57%)
Mutual labels:  rgb, rgbw
rpi-ws2812-server
Raspberry Pi WS2812 (web) server tool
Stars: ✭ 143 (+104.29%)
Mutual labels:  leds, neopixel
ColorPicker
Customizable Color Picker control for WPF
Stars: ✭ 57 (-18.57%)
Mutual labels:  rgb, hsv
colorsys-go
🎃 colorsys-go is a go package(or lib) for everyone to transform one color system to another. The transformation is among RGB, YIQ, HLS and HSV.
Stars: ✭ 75 (+7.14%)
Mutual labels:  rgb, hsv
Wortuhr
Software für eine ESP8266 basierte Wortuhr mit verschiedenen Layouts
Stars: ✭ 30 (-57.14%)
Mutual labels:  rgb, rgbw
Stranger Things Wall
A wall of addressable LEDs inspired by the Netflix series Stranger Things that displays messages from Twitter.
Stars: ✭ 22 (-68.57%)
Mutual labels:  leds, neopixel
rgb-tui
Create and get colors code from the terminal using a nice interface.
Stars: ✭ 57 (-18.57%)
Mutual labels:  rgb, hsv
vscode-color
Helper with GUI to generate color codes such as CSS color notations.
Stars: ✭ 88 (+25.71%)
Mutual labels:  rgb, hsv
ColorHelper
No description or website provided.
Stars: ✭ 34 (-51.43%)
Mutual labels:  rgb, hsv
Wordclock
Diy Wordclock with an esp32 and ws2812b Leds
Stars: ✭ 19 (-72.86%)
Mutual labels:  leds, neopixel
colorsys
🎨 Minimalistic color converter for RGB, HSV, HSL, CMYK, HEX and CSS strings
Stars: ✭ 53 (-24.29%)
Mutual labels:  rgb, hsv
colors-convert
🦚 A simple colors library
Stars: ✭ 15 (-78.57%)
Mutual labels:  rgb
RainbowTaskbar
Customizable Windows taskbar effects.
Stars: ✭ 39 (-44.29%)
Mutual labels:  rgb
WS281x.swift
A Swift library for WS281x (WS2811,WS2812*,WS2813*) RGB led strips, rings, sticks, matrices and more.
Stars: ✭ 32 (-54.29%)
Mutual labels:  neopixel
orange-pi
Orange pi Kicad libraries and footprints.
Stars: ✭ 13 (-81.43%)
Mutual labels:  pi
ESPEasy-Plugin-Lights
ESPEasy Plugins
Stars: ✭ 15 (-78.57%)
Mutual labels:  rgb
H7PI
No description or website provided.
Stars: ✭ 19 (-72.86%)
Mutual labels:  pi
102shows
Raspberry Pi + APA102 + MQTT + 102shows = LED awesomeness!
Stars: ✭ 15 (-78.57%)
Mutual labels:  pi
color
Standard representation of colors, encouraging sharing between packages.
Stars: ✭ 23 (-67.14%)
Mutual labels:  rgb
RemoteLight
A Java based LED Control Software for WS2811 and WS2812 LED strips
Stars: ✭ 59 (-15.71%)
Mutual labels:  neopixel

pi_pico_neopixel

a library for using ws2812b and sk6812 leds (aka neopixels) with Raspberry Pi Pico

example

You'll first need to save the neopixel.py file to your device (for example, open it in Thonny and go file > save as and select MicroPython device. Give it the same name). Once it's there, you can import it into your code.

Initialization

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

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).

Usage

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. If you want to use the library for RGBW, each function works the same just with last parameter being "white": set_pixel(num, (r, g, b, w))

Examples

pixels.set_pixel(5, (10, 0, 0))
pixels.set_pixel_line(5, 7, (0, 10, 0))
pixels.fill((20, 5, 0))

rgbw1 = (0, 0, 50, 0)
rgbw2 = (50, 0, 0, 250)
pixels.set_pixel(42, (0, 50, 0, 0))
pixels.set_pixel_line(5, 7, rgbw1)
pixels.set_pixel_line_gradient(0, 13, rgbw1, rgbw2)

For new settings to take effect you write:

pixels.show()

For more examples, check examples folder.

HSV colors

Library also supports HSV colors. For example you can look at smoothRinbow.py. To use HSV colors, call colorHSV(hue, sat, val) function with hue, saturation and value as parameters. The function returns rgb tuple that you can then use in all other functions.

Hue should be between 0 and 65535. When it becomes larger it just rolls over (65536 -> 0). Saturation and value must be in range from 0 to 255. 255 saturation means just hue, and 255 value is maximum brightness. For more info about HSV colors you can check out Adafruit NeoPixel library documentation and scroll down to HSV section.

color = pixels.colorHSV(32000, 255, 200)
pixels.fill(color)
pixels.show()

Library is extended verison of https://github.com/blaz-r/pico_python_ws2812b, originally forked from https://github.com/benevpi/pico_python_ws2812b.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].