How to tell in code what type of particle board I am using?

I want to automatically switch some digital input pins depending on if my code is running on a Boron or Electron. So I would like to find out, in the code, if the code is running on a Boron or an Electron. Is there a command for that?

You can use the PLATFORM_ID macro which will tell you for which platform the code is running :wink:

https://github.com/particle-iot/device-os/blob/82383b958081a21d119968d7af0247d1699e6499/hal/shared/platforms.h

Nice. Thanks.

1 Like

You can also check for specific features, like Wi-Fi or Cellular, for example.

https://docs.particle.io/reference/device-os/firmware/#checking-for-features

Thanks rickkas7.