Shop Learn P1 Docs P2 Docs Events
Cogless 1-Wire Pixel (WS2811/WS2812 type) Driver — Parallax Forums

Cogless 1-Wire Pixel (WS2811/WS2812 type) Driver

JonnyMacJonnyMac Posts: 8,749
edited 2023-02-03 16:48 in PASM2/Spin2 (P2)

For a work project I need to update a very small quantity of WS2812-type LEDs on two pins. For this application there is no need to consume a cog and fill the object with lots of fanciful support routines. This attached object is small and lean, taking advantage of inline PASM2 to generate the data stream to the pixels.

Keep in mind that this is not using a cog, so you have to manually tell the driver to update your pixels with the .show() method (same as with drivers for other popular microcontrollers).

I have tested my Spin code in Propeller Tool and FlexProp -- it works in both places (though I'm sure at least one forum member will claim it doesn't....).

NOTE: You have to specify the details for your pixel type in the start method, though several suggestions are provided in the object comments. If you're using the WS2811, you'll see that they list the specs for low speed (400kHz) mode; this driver works at 800kHz, hence those values must be halved.

From the WS2811 data sheet.

Special thanks to Terry (@ke4pjw) for providing feedback as I was making final decisions on the driver.


Sign In or Register to comment.