Hi. I am trying to use platformio with Eclipse instead of ArduinoIDE I’ve been using so far as i bump more and more into its limitations as my sources grow in my project.
I created a project with the platformio CLI, copied my sources from my Arduino development environment, then compile it. The strangest problem I have is the compiler does not know LED_BUILTIN. I made some search in the files, and figured out there is apparently a notion of “variant” which determines which file named “pins_arduino.h” is included, and among all the pins_arduino.h files platformio copied on my Mac, the one selected indeed does not define LED_BUILTIN.
So the question: how does platformio determines which variant to use, and how can I configure it to use the one that fits my board.
I use an Metlife ESP32 WROOM dev kit, which does have a builtin led (etc, my code used from the ArduinoIDE works well on these boards, I already deployed two of them)
What board have you selected so far for use in PlatformIO? As it is the board you select that will inform on the variant, as variants are what let board specific settings to be applied. Such as which pin LED_BUILTIN maps to.
I’m presuming it’s the mhetesp32devkit (or probably not, given what happens next), which when you look at the board configuration file, specifies the variant to be mhetesp32devkit, so it seems to have some specific settings, rather than being a generic esp32dev board.
Now, when you look at the mhetesp32devkit variant, it looks like it does specify LED_BUILTIN as pin 2. And a quick look at the copy of the esp32 arduino framework I have installed locally shows it to be present also.
No - board at the command line is the same as board in the platformio.ini. Multiple boards might share the same variant, but have different names. The board configuration file specifies which variant to use, amongst other things.
Don’t you just love it when GitHub breaks and you want to check/link to something… :sigh: Rightyo… looking at my local files… board node32s uses variant esp32 …
… but the esp32 variant DOES NOT define LED_BUILTIN or BUILTIN_LED variables/constants, hence the error. You should only need to change the board = node32s line in your projects platformio.ini to read board = mhetesp32devkit, and assuming that is the right board, when you try to compile again, it work. If it doesn’t try the following (shamelessly stolen from the PlatformIO Eclipse documentation)…
Rebuild PlatformIO Project Index: PlatformIO: Rebuild C/C++ Project Index target