The WS2811/WS2812/WS2812B, WS2813, and SK6812x (or NeoPixel) are RGB LEDs with a tiny controller managed through a single IO. These are available in many form factors including flexible tape, string lights for trees, round and square PCBs, flexible panels, and water-tight strips. The LEDs are available in 5 VDC and 12 VDC formats; power management is important when using a large number of these (or even a small number at full brightness). For example, a Propeller 1 WS2811 application used in the Bud Light Super Bowl commercial required Li-Po battery power supplies worn by roller-skating Blinky, Pinky, Inky and Clyde.
The Propeller 2 is particularly adept at controlling these LEDs with its precision timing, leaving extra processors (cogs) for other tasks also used with LEDs (like MIDI, music, audio, motor control, and sensors). The object presented in this example was created by JonnyMac and was shared in the series of JonnyMac Holiday Spin2 Beginner Series videos. The source code is well-supported with a YouTube video explaining how the objects are used (see link in Additional Resources).
The jm_rgbx_pixel.spin2 driver supports WS2811, WS2812, WS2812b, WS2813, and SK6812x RGB LEDs. In the top file (04_rgbx_pixel_demo.spin2) you need specify which device you are using in the pub setup() method:
After you compile and load the Flash, start Parallax Serial Terminal and press “enter” in the white pane. Choose the demo you’d like to run by pressing one of the keys shown in the menu:
The source code collection has three archived examples in the zip. The differences between them:
- The first shows IF-ELSE for display selection
- The second shows CASE for display selection
- The third uses CASE with animation