First post, please forgive me if the topic/format isn't correct.
I'm attempting to make a basic 120v power monitor using a Boron. It's essentially a pared down version of the same idea I found on youtube.
If house power goes out, the 5V USB power supply will stop powering the Boron and the connected LiPo battery will take over.
I've been able to flash the program to the device previously (2 weeks ago?) but now when I compile it fails with this error:
'class SystemClass' has no member named 'powerSource'
Attempting to troubleshoot, I've pared the program down to this:
// Include Particle Device OS APIs
#include "Particle.h"
// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);
// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
SerialLogHandler logHandler(LOG_LEVEL_INFO);
void setup() {
// INITIAL POWER CHECK
//int powerSource = System.powerSource();
//if (powerSource == POWER_SOURCE_BATTERY) {// ON BATTERY
//}
//else{// ON USB
//}
//if(onBattery){//bootup message alert so we know things are back online
//}else{
//}
}
void loop() {
// POWER CHECK
// EXAMPLE
int powerSource = System.powerSource();
if (powerSource == POWER_SOURCE_BATTERY) {
Log.info("running off battery");
}
}
I'm attempting to compile using the web IDE. Did something change with the System.powerSource function?
My boron reports I'm running version 4.2.0 of the OS.
Any help is greatly appreciated.