Is there anything in the dash class or a function i can create to tell me if the unit is on battery power or running on usb power, also i recall reading something about dash.batteryPercentage not returning correctly is that true or does it return correct values?
I have a side question on this.
Is there a way to see if power to the board drops. And is just battery powered?
kind of the same reason for my question, i want to know if the feed power is lost which will tell me if power is out and i’m running on battery
The Dash will return correct battery charger levels (SOC, known in the battery industry as State of Charge), but only if the battery is connected and the jumpers are set properly. The SOC function will still operate even if the battery is not connected, and jumpers set to AC power, but you’ll see readings in the area of 200% or so. Just the way it works. Accurate readings are possible only when the battery is connected and jumpers are set for battery use. I know it’s been said elsewhere many times as well, but it always bears repeating: never connect the battery unless the jumpers are set properly, vice versa as well, a good way to keep your dash healthy.
One way to do that is to measure the USB 5V in via an analog pin. You will need to use a voltage divider (two resistors) to do this, since 5V direct to an analog pin is too much and will damage the board. Google “voltage divider,” and you will find all you need to know. The Dash will seamlessly revert to battery power when the 5V USB power fails.
See my reply to @crustache. That should have you covered for showing board power status
Thanks Michael, yes I can see that would work well. I was wondering if there was a Dash Class Function cooking that would have some reporting that could indicate input voltage level.
I have not seen one; hopefully someone from Hologram will see and comment.
Well, if the Dash.batterypercentage (or whatever the correct syntax is) is >100, then you’ll know it’s plugged in. If its 100 or less, then its on battery power.