UNOFFICIAL RESPONSE Battery Voltage

Can you help me get my Voltage variable changing because before i added the LCD Display Code Chooser i was able to see the voltage change instantly but know it doesn’t

Here is my code
nleos.zip (3.09 KB)

Copy and paste the code into the

 block in the forums. It'll be easier to deal with and respond to.

what do you mean???

In your reply, click the </> icon in the editor and paste your code in the middle of the back-to-back brackets that get inserted.

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"//
}
      //Short delay for the LCD refresh rate
      wait1Msec(100);

This is only a exert of my program its 400 lines

I looked through your code. I think your issue had to do with the fact that both lines of the LCD were being cleared constantly. See if it fixed your problem.

Original code - lines 284-293:
[s]

  bLCDBacklight = true;                 // Turn on LCD Backlight
  string mainBattery, expanderBattery;

  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
    displayLCDString(0, 0, "Primary: ");
    sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); //Build the value to be displayed
    displayNextLCDString(mainBattery);

[/s]

New code - lines 284-293:
[s]

  bLCDBacklight = true;                 // Turn on LCD Backlight
  string mainBattery, expanderBattery;
  clearLCDLine(0);                      // Clear line 1 (0) of the LCD
  clearLCDLine(1);                      // Clear line 2 (1) of the LCD
  
  while(true)                           // An infinite loop to keep the program running until you terminate it
  {
    displayLCDString(0, 0, "Primary: ");
    sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); //Build the value to be displayed
    displayNextLCDString(mainBattery);

[/s]

EDIT: See the official response instead. I didn’t notice the nested while loops.