B4R Library [code module]ArduinoBoardManager

Attached is a project that demonstrates the use of the ArduinoBoardManager code module (included in the zip file).

The ArduinoBoardManager wraps this GitHub project: https://github.com/backupbrain/ArduinoBoardManager. With this module you can retrieve some info on your board such as board type, cpu type, speed, various memory sizes and some miscellaneous features.

Limits: the board name and a lot of the other info is retrieved based on the cpu name; this can cause unexpected behavior. For example, the real Uno has a 328p whereas the real Nano has a 328. My Nano clone has the 328p so this library reports it as an Uno. Also, the library is limited in what boards it reports. For example, the NodeMCUs are reported as "Board Unknown".

In order for the code module to work, you need to download the .h and .cpp files from the GitHub link. Place them inside Arduino/libraries/ArduinoManager.
 

Attachments

  • ArduinoBoardManager_Test.zip
    2.3 KB · Views: 420
Last edited:

mrred128

Active Member
Licensed User
Longtime User
Out of the box, there is a compile error with the mega.

In the .h, change the

B4X:
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // mega, Mega ADK
  static const uint8_t BOARD = 0x07;
  static const uint8_t NUM_BITS = 8;
  static const uint16_t CPU = __AVR_ATmega1280__;
  static const unsigned long SRAM_SIZE = 8000;
  static const unsigned long EEPROM_SIZE = 4000;
  static const unsigned long FLASH_SIZE = 256000;

With

B4X:
#elif defined(__AVR_ATmega1280__) // mega, Mega ADK
  static const uint8_t BOARD = 0x07;
  static const uint8_t NUM_BITS = 8;
  static const uint16_t CPU = __AVR_ATmega1280__;
  static const unsigned long SRAM_SIZE = 8000;
  static const unsigned long EEPROM_SIZE = 4000;
  static const unsigned long FLASH_SIZE = 256000;
#elif defined(__AVR_ATmega2560__) // mega, Mega ADK
  static const uint8_t BOARD = 0x07;
  static const uint8_t NUM_BITS = 8;
  static const uint16_t CPU = __AVR_ATmega2560__;
  static const unsigned long SRAM_SIZE = 8000;
  static const unsigned long EEPROM_SIZE = 4000;
  static const unsigned long FLASH_SIZE = 256000;
 

Roycefer

Well-Known Member
Licensed User
Longtime User
You should report that error to the GitHub page listed in the original post.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
I found another error in the GitHub files. Do a search in both the .h and .cpp files for "Atmega32u4" and change it to "ATmega32u4" (note the T is capitalized in the latter). This was causing Micros to be reported as "Board Unknown".
 
Top