The leJOS Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail

Trail: Essential leJOS classes
Lesson: Utilities

Utilities: Battery

While your robot depends on the charge of its energy supplier, i.e. the batteries, at times you might feel the urge for dynamically checking this (and maybe returning home when battery charge is low).
To do so, you can use the static methods of the josx.platform.rcx.Battery class: For rechargable batteries a value of 7.5 V is common, for non-rechargable ones it is 9 V.
As a rule a rapidly decreasing value prods to the batteries becoming drained.

When switching on the RCX, the LCD shows the actual charge also.

The Battery API

may be found here.
The leJOS Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail