Tricks for determining different esp32 board types

working with TTGO esp32, EzSBC esp32 , esp8266 NodeMCU Lolin v3, ... and wondering if there's any way to determine the board type either from compiler defines or querying something on the board (GPIO pin pullups)?

Look in boards.txt and find the board of interest. Then look for the "build.board" entry. For example Adafruit ESP32 Feather:

featheresp32.build.board=FEATHER_ESP32

Prepend "ARDUINO_" to the name and use it in a preprocessor conditional statement:

#ifdef ARDUINO_FEATHER_ESP32
// Adafruit ESP32 Feather - specific code here.
#endif

void setup() {
}

void loop() {
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.