sys/arduino: define LED_BUILTIN as frequently used by Arduino sketches#21485
Merged
gschorcht merged 2 commits intoRIOT-OS:masterfrom May 13, 2025
Merged
sys/arduino: define LED_BUILTIN as frequently used by Arduino sketches#21485gschorcht merged 2 commits intoRIOT-OS:masterfrom
gschorcht merged 2 commits intoRIOT-OS:masterfrom
Conversation
In Arduino IDE the on-board LED pin is defined by macro `LED_BUILTIN`. It is used whenever the LED is controlled. To make it easier to use Arduino sketches as they are, `LED_BUILTIN` is defined by using @ref ARDUINO_LED as defined by the board.
benpicco
approved these changes
May 13, 2025
527144c to
7c150d6
Compare
Contributor
Author
|
I had to add Its just a copy from |
Contributor
Author
|
Thanks for reviewing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR defines
LED_BUILTINby usingARDUINO_LEDas defined by a board for compatibility reasons with the Arduino IDE to make it easier to use Arduino sketches as they are.While completing the Arduino I/O mapping for ESP32x in PR #21484 I was wondering why we define
ARDUINO_LEDwhile Arduino sketches mostly useLED_BUILTIN. In Arduino IDE,LED_BUILTINist usually defined for a board an is therefore frequently used to control the on-board LED. The most common exampleBlinkWithoutDelayalso usesLED_BUILTIN.The PR includes
tests/sys/arduino_blinkywhich is just the orginalBlinkWithoutDelayexample without any changes which works in RIOT-OS out of the box with this PR.Testing procedure
Use any board with enabled Arduino features and flash the test app:
I have tested it for a couple of boards:
arduino-unoarduino-mega2560esp32-wemos-d1-r32(PR #21479)nucleo-f103rbIssues/PRs references