Can we connect an RGB LED directly to Core's status LED? [Solved]

Can I simply connect an RGB LED to any pin that would emulate the status LED colors on the Core?

Not that I know of, at least not in a way that would keep the current core LED working also.

However, it would be simple to add a new function to the core

void onChangedRGBLed(uint8_t red, uint8_t green, uint8_t blue);

The firmware would call this anytime a change was made to the LED value. Your app implements this function to then set values on digital pins.


void onChangedRGBLED(uint8_t red, uint8_t green, uint8_t blue) {
   analogWrite(A0, red);
   analogWrite(A1, green);
   analogWrite(A2, blue);

This feature has been requested before, so let me know if it’s useful to you and I’ll have a go at implementing it later today.

1 Like

@mdma that would be a really useful function and I’m curious how you would implement it :smile:

1 Like

This request has come up several times, so I created an issue and a PR for a fix.

As always with pre-release features, you’ll have to build locally to take advantage of it.

To see the state of the LED when it changes, define a new function like this:

void onChangeRGBLED(uint8_t r, uint8_t g, uint8_t b) {
// do stuff with the LED values

It must have that exact name, so copy and paste the code into your application. You can then do what you want with the LED values, e.g. use analogWrite to control an external RGB led.


@mdma that’s exactly what I’m gonna do. Thanks.