In my sketch I do conditional compilation based on the board attached. For example for the Portenta and Nano 33 BLE, I can use the following:
#if defined(ARDUINO_ARCH_NRF52840) // Do Nano 33 BLE stuff #elif defined(ARDUINO_PORTENTA_H7_M7) // Do Portenta stuff #else #error "Unsupported Hardware" #endif // target detection
I'm looking for a similar board variant name for the Pico. I had a look in the Arduino Core repository for the Pico but can't find it.
I've tried RASPBERRY_PI_PICO, but that doesn't work.