Possible to read RGB.brightness() level?

Two questions regarding the brightness control for the onboard RGB LED:
Is it possible to read the existing RGB.brightness() level?
Is there a “default” RGB.brightness level, and is it the same for both Core and Photon?
Thank you!

1 Like

I just pushed a quick fix to the develop branch, so you can write:

uint8_t brightness = RGB.brightness();

But if you’re not building locally, you can already use

uint8_t brightness = Get_LED_Brightness();

The default brightness, 96 (255 is maximum), is set here https://github.com/spark/firmware/blob/develop/services/src/rgbled.c#L8

1 Like

Excellent! Thank you! :smile:

Hi Mat, I noticed this change in the repository because I was searching for a way to get the current RGB color. Would it be possible to get a similar function for the color, probably as a uint32_t return value?

I would very much love to do it myself to actual contribute rather than taking time of you guys, but I have no idea what the policy is and/or how to send a pull-request. Also providing a proper unit-test would be new to me. Is there any documentation/write-ups available about how to go about this as a “regular” user?

This is a great question. I wish we had a post somewhere - How to Contribute. I’ll add it to my todo list!