Universal upload using #ifdef
Posted: Sun Nov 22, 2020 11:24 pm
I am trying to find out if #ifdef can tell the difference between
esp8266 NodeMCU ( 30 pin breadboard version)
Wemos D1 Mini esp8266 (16 pin)
I want to make a way do something like the following,
but it sees both boards as an ESP8266
#ifdef ESP8266
const char * board = "esp8266 on breadboard";
#define DHTPIN D6
#elif WEMOS
const char * board = "D1 mini on window sill";
#define DHTPIN D4
#endif
Serial.print(board);
In the above example both boards print out as:
"esp8266 on breadboard"
Is the board def determined by the board or by the Arduino IDE?
Is there a way to print out what the compiler says the board is?
Is there any way to differentiate between these or any other boards?
Is there any code that might do the following?
Serial.print(boardDef());
My goal is to make it auto configure to the specs of the board I am uploading to without manually changing the code each time.
If no other options work, Would I be able to use LED_BUILTIN as a method of determining which board it is during compile?
esp8266 NodeMCU ( 30 pin breadboard version)
Wemos D1 Mini esp8266 (16 pin)
I want to make a way do something like the following,
but it sees both boards as an ESP8266
#ifdef ESP8266
const char * board = "esp8266 on breadboard";
#define DHTPIN D6
#elif WEMOS
const char * board = "D1 mini on window sill";
#define DHTPIN D4
#endif
Serial.print(board);
In the above example both boards print out as:
"esp8266 on breadboard"
Is the board def determined by the board or by the Arduino IDE?
Is there a way to print out what the compiler says the board is?
Is there any way to differentiate between these or any other boards?
Is there any code that might do the following?
Serial.print(boardDef());
My goal is to make it auto configure to the specs of the board I am uploading to without manually changing the code each time.
If no other options work, Would I be able to use LED_BUILTIN as a method of determining which board it is during compile?