Skip to main content

WS281X_LightBerries

About

Wrapper for rpi_ws281x github.com/rpi-ws281x/rpi-ws281x-python library that defines a bunch of colorful functions.

This library has only been tested on raspberry pi 2 and raspberry pi 3. The lights I have are ws2811 50ct off of amazon with a custom 5v power supply and level converter.

This library is intended for a string of lights not a matrix configuration.

Installation

# from command line run:
sudo pip3 install lightberries

# alternately use pip if python3 is the only python on your system
sudo pip install lightberries

Examples

Quick Demo

# run an endless random demo of functions and light-patterns that assumes you have 100 LEDs
# press CTRL+C to exit the demo

#### Makes the following assumptions ###
## # the number of pixels in the light string
## PIXEL_COUNT = 100
## # GPIO pin to use for PWM signal
## GPIO_PWM_PIN = 18
## # DMA channel
## DMA_CHANNEL = 5
## # frequency to run the PWM signal at
## PWM_FREQUENCY = 800000
## RGB addressing versus GRB
## DEFAULT_PIXEL_ORDER = LED_ORDER.GRB

sudo python3 -m LightBerries

Full Demo

# import the library
from LightBerries import LightController
# the number of pixels in the light string
PIXEL_COUNT = 100
# GPIO pin to use for PWM signal
GPIO_PWM_PIN = 18
# DMA channel
DMA_CHANNEL = 5
# frequency to run the PWM signal at
PWM_FREQUENCY = 800000
# brightness of LEDs in range [0.0, 1.0]
BRIGHTNESS = 0.5
# to understand the rest of these arguments read their documentation: https://github.com/rpi-ws281x/rpi-ws281x-python
GAMMA = None
LED_STRIP_TYPE = None
INVERT = False
PWM_CHANNEL = 0
# create the light-function object
lightController = LightController(ledCount=PIXEL_COUNT, pwmGPIOpin=GPIO_PWM_PIN, channelDMA=DMA_CHANNEL, frequencyPWM=PWM_FREQUENCY, channelPWM=PWM_CHANNEL, invertSignalPWM=INVERT, gamma=GAMMA, stripTypeLED=LED_STRIP_TYPE, ledBrightnessFloat=BRIGHTNESS, debug=True)
# choose a function
lightController.demo(secondsPerMode=5)

Rainbow that scrolls across the lights

# the number of pixels in the light string
PIXEL_COUNT = 100
# GPIO pin to use for PWM signal
GPIO_PWM_PIN = 18
# DMA channel
DMA_CHANNEL = 5
# frequency to run the PWM signal at
PWM_FREQUENCY = 800000
# brightness of LEDs in range [0.0, 1.0]
BRIGHTNESS = 0.5
# to understand the rest of these arguments read their documentation: https://github.com/rpi-ws281x/rpi-ws281x-python
GAMMA = None
LED_STRIP_TYPE = None
INVERT = False
PWM_CHANNEL = 0
# create the light-function object
lightController = LightController(ledCount=PIXEL_COUNT, pwmGPIOpin=GPIO_PWM_PIN, channelDMA=DMA_CHANNEL, frequencyPWM=PWM_FREQUENCY, channelPWM=PWM_CHANNEL, invertSignalPWM=INVERT, gamma=GAMMA, stripTypeLED=LED_STRIP_TYPE, ledBrightnessFloat=BRIGHTNESS, debug=True)
# choose a function
lightController.useColorRainbow()
lightController.functionMarquee()
lightController.run()

Raindrop function

# import the library
from LightBerries import LightController
# the number of pixels in the light string
PIXEL_COUNT = 100
# GPIO pin to use for PWM signal
GPIO_PWM_PIN = 18
# DMA channel
DMA_CHANNEL = 5
# frequency to run the PWM signal at
PWM_FREQUENCY = 800000
# brightness of LEDs in range [0.0, 1.0]
BRIGHTNESS = 0.5
# to understand the rest of these arguments read their documentation: https://github.com/rpi-ws281x/rpi-ws281x-python
GAMMA = None
LED_STRIP_TYPE = None
INVERT = False
PWM_CHANNEL = 0
# create the light-function object
lightController = LightController(ledCount=PIXEL_COUNT, pwmGPIOpin=GPIO_PWM_PIN, channelDMA=DMA_CHANNEL, frequencyPWM=PWM_FREQUENCY, channelPWM=PWM_CHANNEL, invertSignalPWM=INVERT, gamma=GAMMA, stripTypeLED=LED_STRIP_TYPE, ledBrightnessFloat=BRIGHTNESS, debug=True)
# choose a function
lightController.useColorRandom()
lightController.functionRaindrops()
lightController.run()

Release files for LightBerries 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for LightBerries 1.0.1
File Size Uploaded
LightBerries-1.0.1.tar.gz 32.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LightBerries 1.0.1
File Interpreter ABI Platform
LightBerries-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 69.5 kB

Release files / LightBerries-1.0.1.tar.gz

Download URL LightBerries-1.0.1.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d2c5f4a180b3137be2397ad3aeff4db12aae4673de9d60bfe0eccc4afaab0304
BLAKE2b-256 checksum
How to use checksums
19f3bdfdfb0f57c34b3d302912b4c2b25ab60c8283f26a5faa8860078fa287bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3

Release files / LightBerries-1.0.1-py3-none-any.whl

Download URL LightBerries-1.0.1-py3-none-any.whl
Size 36.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bc19a47096b09870c42df928242af822d12d11e8f18936d79eb9fc703b58604
BLAKE2b-256 checksum
How to use checksums
a9088f82e4f194131444ed24e9eed033520714c26e3d0355aadbd5a5a5bd137e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page