In somehow, the percentage of vex battery doesn’t appear in vex screeen. If i want to figure out the percentage of vex battery manually .What is the equation to measure the percentage
Thank you
Are you looking for this in RobotC?
assuming u r using robotc, the variable you use to access the battery level is called “nImmediateBatteryLevel”
which will give you a reading in MilliVolts (MV) and is a system variable, you can use it like this to check the battery level during the program (code from our robot for this season so you’ll have to change it to suit your config ), the preset Variables below are tuned to match the vex iq batteries drain pattern, (High Voltage then Sudden Drop to a constant voltage then another Sudden Drop to where the battery is discharged)
#define MinimumVoltage 6500
#define WarningVoltage 7000
#define SafeVoltage 8500
#define WarningDelay 0
task Battery() {
while (true) {
if (nImmediateBatteryLevel<MinimumVoltage) {
delay(WarningDelay);
playRepetitiveSound(soundCarAlarm4, 100);
setTouchLEDColor(LED, colorRed);
setTouchLEDBlinkTime(LED, 2, 1);
if (nImmediateBatteryLevel<5500) {
stopAllTasks();
stopAllMotors();
};
} else if (nImmediateBatteryLevel<WarningVoltage && !BatteryWarnTrig) {
delay(WarningDelay);
playSound(soundHeadlightsOff);
setTouchLEDColor(LED, colorOrange);
setTouchLEDBlinkTime(LED, 2, 1);
BatteryWarnTrig = true;
sleep(3000);
setTouchLEDBlinkTime(LED, 0, 0);
}else if (nImmediateBatteryLevel>SafeVoltage) {
delay(WarningDelay);
playRepetitiveSound(soundWrongWay, 100);
setTouchLEDColor(LED, colorRed);
setTouchLEDBlinkTime(LED, 2, 1);
};
};
};
and this in your task main
startTask(Battery);
to access it on the robot follow these steps
1.Turn on the Robot
2. Press the X button to enter Settings
3. Then Press the Tick Button to enter System Info
4. The Battert Level in Volts (V) is at the Top of the Screen
"We are using the VEXcode V5 Text IDE to program our VEX V5 robot. We are not using any additional add-ons such as the LED lights. The IDE has a built in API that has methods that gets information from the battery. The methods are: Brain.Battery.capacity(), Brain.Battery.current(), Brain.Battery.voltage(). The formula I currently have is double ENERGY_CAPACITY_OF_VEX_BATTERY = 1.1;
double secondsToHours = Brain.Timer.value()/3600;
double batteryLife =((ENERGY_CAPACITY_OF_VEX_BATTERY - (Brain.Battery.current() * secondsToHours))/ENERGY_CAPACITY_OF_VEX_BATTERY) * 100;
im confused.
- Turn on the robot brain, you start in the main screen usually (unless changed in the settings).
- Hit the X on the robot brain to enter the settings screen.
- Go to System Info
Battery percentage should be displayed on the screen. If you are looking to test your batteries, we use the FRC Battery beak and made a connector that we attached to a VEX IQ battery charger to be able to test our batteries off to the side.
Battery Beak:
Care to share more details about the connector you created?
Here is an image of the tester:
Thanks very much! I think I will create one myself.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.