Unoffical Response to "Battery Voltage Detection?"

In ROBOTC, this is possible using the


, for the main battery, and


for the backup battery (the units are millivolts, IIRC).

As for the main part of your question:

While this is in theory possible, there’s a better way: using a control loop, like a PID. These were very popular last year in order to regulate flywheel speed. There are about a billion different implementations of PIDs in ROBOTC (even one implemented directly) , you should be able to find one to fit your needs.

Our team is using the LCD to display the battery levels. You can view the code at

Oh, thanks. I didn’t know that was a function I could use, though I already switched over to encoders instead, but thanks!

Also, for the power expander you can connect a sensor cable to the “Status” port on the power expander and read the analog value and interpret it as per the instructions on the wiki below

Code would be as follows:

float powerExpanderVoltage = SensorValue[statusPort]/70.0

Provided you are using a Revision A2 power expander