LedWriter: ESP32/8266 Library for easy RGB LED control and non-blocking time-based effects

I’ve been working on this for a while, now, and I know the header is a tad messy with its methods all being public, but at any rate, it works a treat, and it’s easy to use. I’ve had it tucked away within another project, but recently moved it out to its own. I don’t have a lot of experience with C++, so this has been a great opportunity to learn some idioms and paradigms of the language.

Needs more documentation, and I need to figure out how to properly distribute a library like this, but anyway here it is:

Edit: i forgot to add that it’s totally non-blocking, so can be used with networking libraries, as delay() is not called.

8 Likes

Good stuff mate:

2 Likes

ooh I’ll check this out!

really bummed how poor all the motherboard / device RGB software is. Gigabyte Fusion 2 is a complete waste of time, and Asus Aura and Corsair Link not far behind.

i’m programming an esp8266 to run fastled for the ARGB in my case and fans, looks like I might have to add this library to the mix as well if I have enough outputs. hmm 4 for argb (3 discrete fans and 1 strip) and 3 for rgb is 7… should be doable!

1 Like

If you’d make this thing to fetch RGB value from Win10 theme color, you could make these christmas lights work together with switching Wallpaper Engine pictures, which would be something cool :sunglasses:

You can basically do that with hyperion

image

I am making a desk lighting using an RGB strip and wanna drive it with ESP8266, and this might be amazing for me.

So bookmarked!

2 Likes

A couple more things:

This may also work for Arduino boards; I added some preprocessor code to check for ESP or __AVR__, but it

  1. Hasn’t been tested on Arduino devices or clones
  2. Would benefit from a separate object explicitly for I/O.

I like the design philosophy of placing the I/O in the outermost layers, and abstracting the logic. It also becomes many times easier to drop in and change the actual write methods for other devices without digging through so much code. Right now it’s in ColorChannel::write() and overwrite()

now on platformIO library registry:

got some multicore commits coming for esp32 as well

Quick update

The multichannel branch now takes # of channels as a class template arg so should work with RGBW+. Consequently, all methods now require an array param so instead of set(uint16_t, uint16_t, uint16_t) it’s set(std::array<uint16_t, N>).

I love this. Now following this project