VEX2 Battery and Power Control

From ROBOTC API Guide
Jump to: navigation, search
CORTEXFunctions and Variables → Battery and Power Control


Color Key
Function:
Variable:


BackupBatteryLevel

word BackupBatteryLevel
(word) The power level in millivolts of the backup battery. (A value of 9458 represent 9.458 volts.)
int backupLevel = BackupBatteryLevel;  // create and set integer variable 'backupLevel' 
                                       // to the backup battery's power level


nAvgBatteryLevel

int nAvgBatteryLevel
(int) The average battery level in millivolts. (A value of 9458 represent 9.458 volts.) It's the average of 20 recent samples and smoothes out sudden voltage transients.
int nBatteryAverage = nAvgBatteryLevel;  // create and set integer variable 'nBatteryAverage' 
                                         // to the average batter level of the device


nImmediateBatteryLevel

int nImmediateBatteryLevel
(int) The last sampled battery level in millivolts. (A value of 9458 represent 9.458 volts.)
int nBatteryLevel = nImmediateBatteryLevel;  // create and set integer variable 'nBatteryLevel'
                                             // to the immediate battery level