Hello
I’m wondering is it possible to query in the code the board that I have selected when creating the project?
I want to do something like this
snippet:
Thanks for the quick reply but I’m not sure whether it’s addressing my problem.
I want to determine which include statement I have to execute (#include <WiFi.h>) or (#include <ESP8266Wifi.h> (conditional) depending in the board/platform that is defined in PlatformIO (That’s why #if defined() ).
Perhaps something like:
IF PlatformIO.Platform = “Espressif8266” Then #include <ESP8266WiFi.h>
ELSEIF PlatformIO.Platform = Espressif32" Then #include <WiFi.h> #ENDIF
This is exactly correct already. When building for any ESP32* board and framework = arduino, the macro ESP32 will be defined by the builder script, as it would also be in the Arduino IDE. The ARDUINO_ARCH_XXX macros are also a good discriminator. For example, for ESP32, ARDUINO_ARCH_ESP32.
It would be ESP8266 or ARDUINO_ARCH_ESP8266 in the ESP8266 case. (example).
Is there perhaps some documentation about all these macros that can be used without searching and looking in the source code?
I was looking already at PlatformIO IDE — PlatformIO latest documentation but wasn’t successful yet in my effort.
Any suggestion is much appreciated.
If needed, I can post a short snippet of my code that demonstrates what I’m looking for.