|Batery Status as Senor?
|Page 1 of 1|
|Author:||CranoBot [ Wed Mar 07, 2007 6:59 pm ]|
|Post subject:||Batery Status as Senor?|
Hi all! I'm new to C in general but I have a very specific question: How can I read out the battery status and make my NXT's actions dependent from it? I would like it to go charge itself when batery is low. THX for your help.
|Author:||Jesspepette [ Thu Mar 08, 2007 3:30 am ]|
you should find many interesting things there in the RobotC Software Help:
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.
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.
This function call will immediately turn off the NXT
A Boolean flag that, when set, indicates the NXT should not automatically power off when powered by an AC adaptor.
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.
The average of several recent samples of the battery voltage. A value of 7500 indicates a voltage of 7.5 volts.
The most recent sampled value of the battery voltage.
The number of minutes of inactivity that will trigger automatic power off of the NXT.
The low voltage value that will trigger automatic shutdown of the NXT. A value of 6100 indicates a shut down at 6.1V.
And this sample program should help:
|Author:||CranoBot [ Thu Mar 08, 2007 5:13 am ]|
THX a lot.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group