Does anyone know how to program the LCD Display to get the voltages. I have this program but i need to put the secondary voltage on here because we have a battery expander.
/*
Display Battery Voltage
ROBOTC on VEX 2.0 Cortex
This program uses the Display functions of ROBOTC on the VEX 2.0 Cortex platform.
It will display the value of the main battery on line 0 and backup battery on line 1.
while(true) // An infinite loop to keep the program running until you terminate it
{
clearLCDLine(0); // Clear line 1 (0) of the LCD
clearLCDLine(1); // Clear line 2 (1) of the LCD
//Display the Primary Robot battery voltage
displayLCDString(0, 0, "Primary: ");
sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); //Build the value to be displayed
displayNextLCDString(mainBattery);
//Display the Backup battery voltage
displayLCDString(1, 0, "Secondary: ");
sprintf(secondaryBattery, "%1.2f%c",nImmediateBatteryLevel/1000.0, 'V'); //Build the value to be displayed
displayNextLCDString(secondaryBattery);
//Short delay for the LCD refresh rate
wait1Msec(100);
}
So in RobotC, there is no easy way to display power expander battery level. The built in function “secondarybatterylevel” references the backup battery plugged into the cortex(9V battery). Our teams programmer managed to get it to work last year, although he has now graduated and I am unable to get the code from him as he is now on his mission. I believe however that JPearman has a thread either on here, or the RobotC forums describing how he was able to do this.
The expander must be connected from that extra wire port on the expander to the CORTEX, and it should be considered as an analog sensor on motors and sensor setup.
Here is a code that is took directly from our Delta II program(Basically it displays when it’s below 8V):
string expanderBattery;
//* Expander Battery Displaying *//
if(SensorValue[Power]<2240){ //If Expander Battery is below 8V (2240 Value)//
clearLCDLine(1); //Clear LCD line 1 (Bottom Line)//
displayLCDString(1, 0, "Exp. Low: "); //Display Expander Low//
sprintf(expanderBattery, "%1.2f%c", SensorValue[Power]/280.0, 'V'); //Build the value to be displayed//
displayNextLCDString(expanderBattery); //Display the string "expanderBattery"//
}