Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Library Install and Strip Example
First: Follow the BiblioPixel installation instructions.
pyserial is required. Install with
pip install pyserial --upgrade. If you are running on a Raspberry Pi, pyserial is already installed but it's too old and owned by the OS. To upgrade, use
sudo pip install pyserial --upgrade --ignore-installed
IMPORTANT: BiblioPixel v3 now requires Python 3.4+! If you must use Python 2, please follow the BiblioPixel v2 install instructions
IMPORTANT: You must either install the 300 Ohm resistors or short the jumper pads at R6 and R7 for the AllPixel to communicate with the LEDs!
The AllPixel has been designed in conjunction with the BiblioPixel Python library, allowing it to be controlled from anything that supports Python and USB Serial. Testing the AllPixel for the first time is easy. The supported LED types are listed below. Be sure to change your LED type on line 8 of the below code example ('ledtype = LEDTYPE.xxxxxx').
import bibliopixel # causes frame timing information to be output bibliopixel.log.setLogLevel(bibliopixel.log.DEBUG) # Load driver for the AllPixel from bibliopixel.drivers.serial import * # set number of pixels & LED type here driver = Serial(num = 10, ledtype = LEDTYPE.WS2812B) # load the LEDStrip class from bibliopixel.layout import * led = Strip(driver) # load channel test animation from bibliopixel.animation import StripChannelTest anim = StripChannelTest(led) try: # run the animation anim.run() except KeyboardInterrupt: # Ctrl+C will exit the animation and turn the LEDs offs led.all_off() led.update()
Since you are changing the type and number of LEDs that the AllPixel is controlling, it will quickly reboot as it re-configures itself. You will see something like this:
INFO - serial_driver - Using COM Port: COM5, Device ID: 0 INFO - serial_driver - Reconfigure and reboot needed, waiting for controller INFO - serial_driver - Reconfigure success!
It should display something like this:
No matter how many LEDs you configured above, you will only see the first 10 light up in this case because that is all this test animation controls.
If the RGB ordering is correct, the pattern should start with 1 Red, 2 Green, and 3 Blue LEDs. If you see different colors, the count of each color tells you the position for that color in the channel order. So, for example, if you see 2 Blue, and 1 Red, and 3 Green LEDs then the channel order should be RBG (Red, Blue, Green) and the driver should be configured as such:
driver = Serial(num = 10, ledtype = LEDTYPE.WS2812B, c_order = ChannelOrder.RBG)