[Resolved]- How do I disable the internal RGB LED?

@BDub, do you know if its possible to disable the on-board RGB but allow a mirrored/on-change off board RGB. This would be for battery powered applications. This would save battery by not having 2 RGB’s on.

Thanks

There is not specifically an API for disabling the on-board RGB, but I was going to suggest the same thing Scruffr has, except I was going to initially recommend OUTPUT since it should consume less current than leaving a pin floating… albeit probably not too much to be concerned with. Just a habit of mine to declare unused pins as OUTPUT (LOW) when there is nothing connected to them and I know they are on a PCB with nothing that’s going to connect to them in the future. However in this case, if it’s a Photon, the RGB LED is common Anode and connected to 3V3 so you’d have to define the OUTPUT (HIGH) which doesn’t seem like a great idea. With the P1 my default strategy might make more sense, and unused pins in general. During reset though, those pins will float again, so it’s best to tie off unused pins with an external weak pull up resistor so they have a defined state during reset. Maybe your design can’t tolerate external pullup/down resistors sprinkled in various places if it’s really small or you are conserving every penny on the design.

The RGB LED (and series 1k ohm resistors) on the Photon kind of acts like an external pullup resistor all by itself, so just INPUT mode should be fine! Another way would be to define the RGB pins with INPUT_PULLUP to be redundant (but don’t forget that when using internal pullup or pulldown resistors the pins cannot be 5V tolerant anymore).

It’s good to understand WHY you are setting the pins to a particular mode, because when you design a product you need to think about each pin differently and how it will be used over the life of the product.

// disable on-board RGB LED on Photon/Electron
pinMode(RGBR, INPUT_PULLUP);
pinMode(RGBG, INPUT_PULLUP);
pinMode(RGBB, INPUT_PULLUP);

// disable on-board RGB LED on P1
// also add external 10k ohm pullup resistors on these pins
pinMode(RGBR, INPUT);
pinMode(RGBG, INPUT);
pinMode(RGBB, INPUT);
4 Likes

@BDub @ScruffR thanks for the help and great explanation!

2 Likes