I am doing a project where each atmega is controlling a single dumb LED

I am doing a project where each atmega is controlling a single dumb LED strip. FastLED looks like it has come a long way since the last time I looked at it years ago and has a lot of cool features that will make the project a lot quicker/nicer. Originally I was just going to use CRGB and CHSV directly, but after reading more there are a lot of cool things that get done to CRBG in the controller before showing (like global brightness and dithering).

I was going to try to write a simple controller for controlling just a single LED to take advantage of those features.

Before I started I figured I would ask here to see if it has already been done?

If not is it as simple as inheriting from CPixelLEDController and overwritting showPixels?

Can you clarify what the goal is? How is that different from what the existing controllers do?

Check out this example for working with a simple “dumb” LED.

You could also create a fake LED strip with number of pixels of 1 and code stuff that way, and then pull the R, G, B data out and use it however you liked.

Ah OK, now I understand.

At one point I cobbled together a controller implementation for the PCA9685 PWM chip, which can be used to control a bunch of dumb LEDs. It supports 16 channels, so it can handle five RGB LEDS.

My goal is to use FastLED with all of its features for an LED strip that is essentially 1 pixel.

Marc, that is essentially what I was thinking of doing in the first place, but then I thought that the ‘global’ features would be nice to preserve and those seem to be run when FastLED.show() is called. What i was doing and what your example shows bypasses using show().

So creating a CPixelLEDController is needed so that it can be added to the controller list.

I was using the DMX controller as a starting point and it compiles fine, but I am getting errors now with mine (below). I am not seeing in the PixelController class how to access the CRBG data. In the DMX controller (and the others I have looked at) it uses loadAndScale to get the data, but I am not seeing that defined anywhere either.

I am getting:
In member function ‘virtual void DumbController<RED_PIN, GREEN_PIN, BLUE_PIN>::showPixels(int&)’:

error: request for member ‘loadAndScale0’ in ‘pixels’, which is of non-class type ‘int’

template <uint8_t RED_PIN, uint8_t GREEN_PIN, uint8_t BLUE_PIN> class DumbController : public CPixelLEDController<RGB_ORDER> {
// initialize the LED controller
virtual void init() { }

virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
analogWrite(RED_PIN, 255 - pixels.loadAndScale0());
analogWrite(GREEN_PIN, 255 - pixels.loadAndScale1());
analogWrite(BLUE_PIN, 255 - pixels.loadAndScale2());

Maybe I should just not waste time on this to get a few extra features that I can easily do myself for just 1 pixel. But I thought it would be nice to just have a controller to grab when I need it and keep everything the same as projects that use addressable leds.

Ok I understand what you were asking now. And in addition to global brightness you could also take advantage of the color correct and even power management if needed.
Unfortunately I’m not familiar enough with how that works to provide any tips for getting the output you’re looking for.

Thanks for trying :slight_smile:

I’ll just move forward using CRGB and CHSV directly and maybe I can revisit this if someone has deeper understanding of controllers.

This compute adjustment or get adjustment stuff is what you’re interested in, right?

@Seph_Bain , that looks like it should work. It is very strange that the compiler thinks that the argument to showPixels is an int. Is this code in chipsets.h?

No, I put it in it’s own file that I used dmx.h as a template for. That way if the library is updated I will not lose the code. I thought it was strange that it thought it was an int as well.

You might want to try pasting that code directly into chipsets.h, just to see if it is some weird template/header file thing.