Difference between revisions of "NXT Battery and Power Control"

Jump to: navigation, search
Line 1: Line 1:
<yambe:breadcrumb>NXT_Functions_and_Variables|NXT Functions and Variables</yambe:breadcrumb>
<yambe:breadcrumb self="Datalog">NXT_Functions_and_Variables|Functions and Variables</yambe:breadcrumb>

Revision as of 19:21, 18 April 2012

The NXT firmware keeps track of the minutes of inactivity on a NXT. When this exceeds a configurable limit, then the NXT will automatically power off. Inactivity is defined as time without a user keypress.

The inactivity timeout value can be set via the NXT GUI. It can also be set via editing ROBOTC property pages. Whenever ROBOTC makes a connection to a NXT it will set the timeout value to the value from the property page configuration.

Note that the NXT can behave unpredictably at low voltages and when trying to write to flash memory. So whenever ROBOTC attempts a connection between PC and NXT, it checks the battery voltage. If the voltage is too low for reliable operation, the ROBOTC connection will be aborted.

Color Key


void alive()
(void) Periodically calling this function will reset the timer used to put the controller to sleep after long periods of inactivity.
alive();  // reset the timer


void powerOff()
(void) Immediately powers off the controller.
powerOff();  // power off the controller


bool bNoPowerDownOnACAdaptor
(bool) A flag to tell the NXT not to power down if it is connected to an AC power source. True = will NOT power down, False = WILL power down.
bNoPowerDownOnACAdaptor = true;   // will NOT power down when connected to AC adapter
bNoPowerDownOnACAdaptor = false;  // WILL power down when connected to AC adapter


bool bNxtRechargable
(bool) Boolean variable. Indicates whether the NXT is currently using a rechargable battery pack.
  // this code runs if evaluated as TRUE


int LowVoltageBatteryCountLimits
(int) The NXT will generate a "low voltage" pop up on the display when a specified amount of consecutive battery voltage samples are at a low voltage. Set this variable to the amount you wish, where 0 disabes the pop up entirely.
LowVoltageBatteryCountLimits = 10;  // notify me when 10 consecutive readings are low


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


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


int nPowerDownDelayMinutes
(int) Specifies the number of minutes of inactivity (i.e. no buttons pressed) used by the sleep timer for automatic power off of controller. The controller automatically powers off to conserve battery power.
nPowerDownDelayMinutes = 15;  // power off after 15 minutes of inactivity


int nPowerDownDelayMinutesDefault
(int) The default number of minutes of inactivity used by the sleep timer for automatic power off of controller.
nPowerDownDelayMinutes = nPowerDownDelayMinutesDefault;  // power off after the default amount
                                                         // of time has passed without any activity