Arm Mbed OS support forum

How can I test at runtime for an optional LED, button etc

I want to have one executable that can run on different variants of a board. As a absurdly simple example one board has 1 LED and another board has 2 LEDs.
I do not what to use the compile time define as that would require seperate executables.
Source example that will not compile when only LED1 is defined.

if (LED2) {DigitalOut myLED(LED2); myLED = 1;}

Hello,

I really not understand how this is related to the MbedStudio - feedback section. There are section for Application development or eventually Best practice.

I am not expert, but I am not sure if that is possible only via software.
Maybe you can use a resistor or jumper as hardware identifikator, check its value at the start of program and control the rest of program according to that value.

BR, Jan

This is in response to the announcement of

Standard pin names
and the example given which uses a compile time define to generate code or suppress the code generation.