Overview
- Object ID : 2691 (2014-11-23)
- Author : Chad McFall | added by Archiver
- Content : Code
- Microcontroller : Propeller 1
- Language : C/C++
- Category : Display
- Licence : Other
Content
A brand new ground-up C/ASM Driver for WS2811, WS2812S, and WS2812B addressible LEDs. Thanks to red for introducting me to the Propeller chip, and to JonnyMac for his prior SPIN Driver that sparked my interest in WS2812 LEDs.
This is the first driver I've published, so forgive me if I didn't format it properly. It works though, I've tested it on dozens of devices and thousands of WS2812s.
Chad McFall- 2014-11-23
// This sample code will light the first 3 leds red, green, and blue:
char outputPin=0;
char numberOfLEDs=10;
char initCog=1;
WS2812 myLedArray;
WS2812init(outputPin, numberOfLEDs, TIMING_WS2812B, &myLedArray, initCog);
while(1)
{
WS2812SetLEDInBuffer(0, 20, 00, 00, &myLedArray); //LED 0 Red
WS2812SetLEDInBuffer(1, 00, 20, 00, &myLedArray); //LED 1 Green
WS2812SetLEDInBuffer(2, 00, 00, 20, &myLedArray); //LED 2 Blue
WS2812Update(&myLedArray);
}
I am using this code to play with the Parallax FLiP Holiday Light Kit with over the air WiFi downloading.
I am guessing that some sort of initialization is missing from the sample code above.
It seems to work great except that I have to send the code twice in order for the changes to take effect. I am using the sample code, changing the intensity levels. No change occurs with the first download. It takes effect immediately when I click download a second time.
I tested blinking the P26 LED at different intervals and that takes effect on the first download. That makes me feel pretty confident that the problem is in how I am using this library, not the basic WiFi downloading setup.
Thanks for any suggestions.