LCD Screen Backup Battery Display

Hi our robotics team recently added an LCD screen to display our battery and choose an autonomous. However, when displaying the battery the primary voltage is correct but the backup battery level is just 8.15V. I cannot figure out how to fix this.

When you say backup battery, do you mean the battery on the power expander?

yes, I have tried replacing the status wire and the expander but it still only says 8.15V

Could you post your code so we can take a look? But 8.15 V seems reasonable for a fully charged battery, use a multimeter to compare the values.

I’ve used a modified version of the sample code and the sample code itself but no matter what the reading it gives is 8.15 even if the battery is low.

This is the function I’m using
task displayBattery
{
while(true)
{
wait1Msec(5);
clearLCDLine(0);
clearLCDLine(1);
//Display the Primary Robot battery voltage
displayLCDString(0, 0, "Primary: ");
sprintf(mainBattery, “%1.2f%c”, nImmediateBatteryLevel/1000.0,‘V’);
displayNextLCDString(mainBattery);

	//Display the Backup battery voltage
	displayLCDString(1, 0, "Backup: ");
	sprintf(backupBattery, "%1.2f%c", BackupBatteryLevel/1000.0, 'V');
	displayNextLCDString(backupBattery);
	wait10Msec(100);
}

}
and then I use it in user control
task usercontrol()
{
startTask(displayBattery);
while (true)
{

Backup battery level is the battery level for the 9V backup battery that is attached to the Cortex. To get the power expander battery, you have to use the power expander status port as an analog sensor on the Cortex. There’s more information on the VEX wiki page for the power expander.

Ok, so is my code wrong to get the battery value?
If so, is this right?

int battery2Level;
	while(true)
	{
		battery2Level = (int)((float)SensorValue[in1] * 5.48);
		wait1Msec(5);
		clearLCDLine(0);
		clearLCDLine(1);
		//Display the Primary Robot battery voltage
		displayLCDString(0, 0, "Primary: ");
		sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V');
		displayNextLCDString(mainBattery);

		//Display the Backup battery voltage
		displayLCDString(1, 0, "Backup: ");
		sprintf(backupBattery, "%1.2f%c", battery2Level, 'V');
		displayNextLCDString(backupBattery);
		wait10Msec(100);
	}