Dim power As PowerStatus = SystemInformation.PowerStatus
Dim percent As Single = power.BatteryLifePercent
or
PowerStatus power = SystemInformation.PowerStatus;
float percent = power.BatteryLifePercent;
(I would prefer a vb answer as that is what the application is written in but can convert so c# is fine if you dont know vb)
I understand that the above will give me the battery percentage remaining - BUT I have a tablet that is 'hot swappable' (it has a main battery then a small 5 minute battery that runs the tablet while you swap batteries on it) - how would I find the status of the second battery?
I am looking for something like SystemInformation.PowerStatus(0)
but I have NO idea what I am actually trying to find and I must be having a Google block as I cannot find anything.
For longer trips, a traditional dual battery system is often preferred. If you're planning to be off-grid for long periods of time or be constantly on the move, a dual battery system allows you to tailor the system to your specific needs.
Diesel trucks have two batteries, as opposed to most cars, which have only one. Diesel trucks need two batteries so they can crank at a higher amp. This is needed because a diesel engine demands a high-resistance load to start successfully.
You can use WMI and Win32 to get the battery levels.
Try this:
ObjectQuery query = new ObjectQuery("Select * FROM Win32_Battery");
foreach (ManagementObject o in new ManagementObjectSearcher(query).Get())
{
uint level = (uint)o.Properties["EstimatedChargeRemaining"].Value;
}
In case of multiple batteries, you can make use of WMI. Specifically, Win32_Battery class.However, this will be a bit slower than using PowerStatus
class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With