So I’m trying to use System.powerSource() and .batteryState() with this test code:
(using an electron, running 1.5.2)
int powerSource;
int batteryState;
void setup() {
Serial.begin(9600);
Particle.variable("pwrSrc", powerSource);
Particle.variable("battState", batteryState);
}
void loop() {
powerSource = System.powerSource();
batteryState = System.batteryState();
Serial.printlnf("pwr src: %f || batt state: %f", powerSource, batteryState);
delay(1000);
}
In my serial monitor (i’ve actually got this running with other code thats using a .publish, it’s seeing the same thing), i get 0 for both powerSource and batteryState. what confuses me, is that when i look at the variable through the console, it’s giving me the right numbers for them both. Where am I going wrong here?