Battery & Power Control

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.

 

alive()

Calling this function resets the “inactive power down” timer.

 

If a application program is running and it periodically calls the ‘alive()’ function, then this will prevent the NXT from auto power off.

 

powerOff()

This function call will immediately turn off the NXT

 

bNoPowerDownOnACAdaptor

A Boolean flag that, when set, indicates the NXT should not automatically power off when powered by an AC adaptor.

 

bNxtRechargable 

A Boolean flag that indicates whether the NXT is powered from a LEGO rechargeable battery. There is a hidden switch inside the NXT battery compartment that is depressed when a LEGO rechargeable battery is used. This variable reads the value of this switch.

 

nAvgBatteryLevel

The average of several recent samples of the battery voltage. A value of 7500 indicates a voltage of 7.5 volts.

 

nImmediateBatteryLevel

The most recent sampled value of the battery voltage.

 

nPowerDownDelayMinutes

The number of minutes of inactivity that will trigger automatic power off of the NXT.

 

nShutdownVoltage  

The low voltage value that will trigger automatic shutdown of the NXT. A value of 6100 indicates a shut down at 6.1V.