Defining Hardware in INO, re: Reading BAT_DET/P0.05/AIN3


New to the Particle web IDE, but experienced with Arduino and m0 low level board definitions and hardware abstraction files.

I’m trying to read the analog voltage for the battery and I’m getting compilation errors due to BATT not being defined. I suspect that the IDE doesn’t know what hardware I’m compiling for and doesn’t include the HAL file for the Argon/Xenon where BATT is defined as pin 24 or 33?

Ultimately, the question is is there a way to “define” the hardware in the IDE? How is the best way to code to read that pin?




OK, well as always about 3 minutes after I post a question I dive in again and locate the answer…

It appears the IDE needs the user to select the hardware in the Flash tab by starring the board you’re flashing to…

Oops, answered without reading to the end - you found it already :blush:

In the bottom right corner of Web IDE you should see an indication of device you are targeting.
If it's not the one you intend to target you need to go into the target drawer image and click the star next to the device so it turns "golden" (and if you haven't already r.27 as device OS version selected, do that too).

Here are the docs on how to Select Your Device