Electron USB Charging Status

Hi,

How can I know if an Electron is charging via the USB port programmatically ?

Thanks
James

The easiest is typically System.batteryState().

https://docs.particle.io/reference/device-os/firmware/electron/#batterystate-

Thanks