Skip to content

sys/arduino: define LED_BUILTIN as frequently used by Arduino sketches#21485

Merged
gschorcht merged 2 commits intoRIOT-OS:masterfrom
gschorcht:sys/arduino/led_builtin
May 13, 2025
Merged

sys/arduino: define LED_BUILTIN as frequently used by Arduino sketches#21485
gschorcht merged 2 commits intoRIOT-OS:masterfrom
gschorcht:sys/arduino/led_builtin

Conversation

@gschorcht
Copy link
Copy Markdown
Contributor

Contribution description

This PR defines LED_BUILTIN by using ARDUINO_LED as 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_LED while Arduino sketches mostly use LED_BUILTIN. In Arduino IDE, LED_BUILTIN ist usually defined for a board an is therefore frequently used to control the on-board LED. The most common example BlinkWithoutDelay also uses LED_BUILTIN.

The PR includes tests/sys/arduino_blinky which is just the orginal BlinkWithoutDelay example 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:

BOARD=arduino-uno make -j4 -C tests/sys/arduino_blinky flash

I have tested it for a couple of boards:
arduino-uno
arduino-mega2560
esp32-wemos-d1-r32 (PR #21479)
nucleo-f103rb

Issues/PRs references

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.
@github-actions github-actions bot added Area: tests Area: tests and testing framework Area: arduino API Area: Arduino wrapper API Area: sys Area: System labels May 13, 2025
@gschorcht gschorcht added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 13, 2025
@gschorcht gschorcht requested review from maribu and removed request for MichelRottleuthner, aabadie and leandrolanzieri May 13, 2025 06:18
@riot-ci
Copy link
Copy Markdown

riot-ci commented May 13, 2025

Murdock results

✔️ PASSED

7c150d6 tests/sys/arduino_blinky: add most common Arduino example as test app

Success Failures Total Runtime
10346 0 10346 14m:24s

Artifacts

@maribu maribu added this pull request to the merge queue May 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 13, 2025
@gschorcht gschorcht force-pushed the sys/arduino/led_builtin branch from 527144c to 7c150d6 Compare May 13, 2025 12:52
@gschorcht
Copy link
Copy Markdown
Contributor Author

I had to add Makefile.ci with BOARD_INSUFFICIENT_MEMORY for nucleo-l011k4. No idea, why CI didn't catch it before.

Its just a copy from tests/sys/arduino_lib. Therefore I squashed it directly.

@gschorcht gschorcht enabled auto-merge May 13, 2025 12:56
@gschorcht gschorcht added this pull request to the merge queue May 13, 2025
Merged via the queue into RIOT-OS:master with commit a8f9213 May 13, 2025
25 checks passed
@gschorcht
Copy link
Copy Markdown
Contributor Author

Thanks for reviewing.

@gschorcht gschorcht deleted the sys/arduino/led_builtin branch May 13, 2025 22:14
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: arduino API Area: Arduino wrapper API Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants