Is there any way to get the board type programmatically?

I have a program that contains code that will run on the electron but not the photon, is there any way to check the board type programmatically? Something like:

#if BOARD_ELECTRON dostuff() #endif

That would be the PLATFORM_ID

 0  ... Spark/Particle Core
 6  ... Particle Photon
 8  ... Particle P1
10  ... Particle Electron
88  ... RedBear Duo

But what exactly do you want to target?
Sometimes it’s better to check for the presence of a particular feature than relying on the platform, since new hardware might provide the same feature but have a yet unknown PLATFORM_ID and hence your code would fail to support the hardware although it would be available.

2 Likes

Confirmed:

and:

 82 ... Digistump Oak
103 ... Bluz DK
2 Likes

I was just looking up bluz and totally forgot Oak (since I haven’t got mine yet :wink: )

2 Likes