I want to write a sketch that can be compiled on different Arduino boards. I want to display on the PC which board is currently connected.
This means that the user connects the PC via USB cable to the Arduino/Teensy board in which runs my sketch and my sketch tells the PC via Serial which board is connected. On the PC runs my C# application which receives this data and displays it.
Therefore I need the board that has been selected when the sketch has been compiled:
I found the code on https://github.com/backupbrain/ArduinoBoardManager but it does not give correct results (apart from the fact that several boards are missing).
Here a snippet from the code:
static const uint8_t BOARD_MICRO= 0x04; .... #elif defined(__AVR_Atmega32U4__) // Yun 16Mhz, Micro, Leonardo, Esplora static const uint8_t BOARD = 0x04; static const uint8_t NUM_BITS = 8; static const uint16_t CPU = __AVR_Atmega32U4__; static const unsigned long SRAM_SIZE = 2500; static const unsigned long EEPROM_SIZE = 1000; static const unsigned long FLASH_SIZE = 32000; #elif defined(.....
So this code gives the same result (BOARD = 0x04 = Micro) for Yun 16MHz, Micro, Leonardo y Esplora.
Is there any way to get in my C code exactly the string that the user has selecetd in the menu of the Arduino compiler?