LCD Display Programming

I am trying to program a LCD Display for our competition robot. I just want it to show the battery voltage for now. I have tried using the sample programming but then nothing but the LCD works. please help.

Everything that your driver program does needs to be within a single “while” loop. Make sure you do not have a while loop for the LCD and a second while loop for driver control.

task usercontrol()
{
  char mainBattery[20]
  
  clearLCDLine(0);                      // Clear line 1 (0) of the LCD
  clearLCDLine(1);                      // Clear line 2 (1) of the LCD

  while (true)
  {
    //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);
    
    // control robot
    motor port1 ] = vexRT Ch1 ];
    motor port2 ] = vexRT Ch2 ];
  
    wait1Msec(20);
  }
}