Skip to content

Implement LED_BUILTIN constant + digitalWrite() overload for RGB LED #6783

Closed
@PilnyTomas

Description

@PilnyTomas

Related area

RGB LED, Blink example

Hardware specification

C3, S3, dev boards with RGB LED

Is your feature request related to a problem?

No issue found

Describe the solution you'd like

Implement LED_BUILTIN constant for dev boards with RGB LED. Where not applicable print a helpful error message - for example, This board does not have builtin LED instead of default error: 'LED_BUILTIN' was not declared in this scope
For boards with RGB LED overload function void digitalWrite(uint8_t pin, uint8_t val) to activate the RGB LED via the appropriate driver.
Sample use of overloaded function:

digitalWrite(LED_BUILTIN, HIGH); // RGB turns full white
digitalWrite(LED_BUILTIN, LOW); // RGB turns off

// Nice to have (1) - ability to control each channel
digitalWrite(RED_LED_BUILTIN, HIGH); // Red channel full brightness
digitalWrite(GREEN_LED_BUILTIN, HIGH); // Green channel full brightness
digitalWrite(BLUE_LED_BUILTIN, HIGH); // Blue channel full brightness
// Similar for LOW -> channel is off

// Nice to have (2) - ability to control brightness
digitalWrite(RED_LED_BUILTIN, 128); // Red channel turns on to 50% brightness

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions