Basic provides several functions which can be used to monitor the status of the battery.
GetBatteryStatus() |
0 = Waiting for Data |
GetBatteryLevel() |
This function returns the current battery level. |
GetBatteryScale() |
This function returns the maximum battery level. Percent = GetBatteryLevel() / GetBatteryScale() * 100 |
GetBatteryTemp() |
This function returns the current battery temperature in celsius. |
GetBatteryVolts() |
This function returns the current battery voltage. |
It takes a few seconds for battery info to be returned from Android the first time you request the info. Placing the following code at the beginning of your program will pause your program until the data becomes available. timeout = Time() + 5000 |