Battery Voltage - Argon
The Argon device does not have a fuel gauge chip, however you can determine the voltage of the LiPo battery, if present.
float voltage = analogRead(BATT) * 0.0011224;
The constant 0.0011224 is based on the voltage divider circuit (R1 = 806K, R2 = 2M) that lowers the 3.6V LiPo battery output to a value that can be read by the ADC.
The charge indicator on the Argon can be read using:
bool charging = !digitalRead(CHG);
In other words, the
CHG input is 0 when charging and 1 when not charging, and the
! inverts this logic to make it easier to use.
This technique applies only to the Argon and Photon 2. For the Boron, Electron, and E Series, see the FuelGauge, below.
The Photon and P1 don't have built-in support for a battery.