Arduino BMS - minor issues

This is some code to measure 20 cells in a lifepo4 battery and display bar graph on a tft screen.

A few minor problems:

  1. print to tft doesnt work, eg myGLCD.print(line1, 60, line1-10, 270);
    it wants char * in the function but I have tried char(line1) and char * line1 but it still gives error
  2. print of myGLCD.print(“3.36”, 60, line1-10, 270); (replacing line1 with “3.36”) is very slow, especially doing it 20x. Is this normal and can anything be done?
  3. the white bars were not going down in size unless I cleared the space first with a blue rectangle. Is there a simpler method?
#include <UTFT.h>
extern uint8_t SmallFont[];
UTFT myGLCD(CTE32HR,38,39,40,41);
float bat1, bat2, bat3, bat4, bat5, bat6, bat7, bat8, bat9, bat10, bat11, bat12, bat13, bat14, bat15, bat16, bat17, bat18, bat19, bat20;
int line1, line2, line3, line4, line5, line6, line7, line8, line9, line10, line11, line12, line13, line14, line15, line16, line17, line18, line19, line20;
void setup()
{
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
  //myGLCD.setFont(SevenSegNumFont);
  myGLCD.clrScr();
  myGLCD.fillScr(VGA_BLUE);
  //myGLCD.fillRoundRect(0, 0, 480, 320); //left,top,right,bottom
  myGLCD.setColor(VGA_WHITE);
  myGLCD.setBackColor(VGA_BLUE);
  Serial.begin(9600);
  myGLCD.print("Charge", 5, 52);
  myGLCD.print("100%", 5, 109);
  myGLCD.print("0%", 5, 247);
}
void loop()
{
  digitalWrite(1, HIGH);
  delay(50);
  bat1 = analogRead(A0);
  digitalWrite(1, LOW);
  delay(5);
  digitalWrite(2, HIGH);
  delay(50);
  bat2 = analogRead(A0);
  digitalWrite(2, LOW);
  delay(5);
  digitalWrite(3, HIGH);
  delay(50);
  bat3 = analogRead(A0);
  digitalWrite(3, LOW);
  delay(50);
  digitalWrite(4, HIGH);
  delay(50);
  bat4 = analogRead(A0);
  digitalWrite(4, LOW);
  delay(5);
  digitalWrite(5, HIGH);
  delay(50);
  bat5 = analogRead(A0);
  digitalWrite(5, LOW);
  delay(5);
  digitalWrite(6, HIGH);
  delay(50);
  bat6 = analogRead(A0);
  digitalWrite(6, LOW);
  delay(5);
  digitalWrite(7, HIGH);
  delay(50);
  bat7 = analogRead(A0);
  digitalWrite(7, LOW);
  delay(5);
  digitalWrite(8, HIGH);
  delay(50);
  bat8 = analogRead(A0);
  digitalWrite(8, LOW);
  delay(5);
  digitalWrite(9, HIGH);
  delay(50);
  bat9 = analogRead(A0);
  digitalWrite(9, LOW);
  delay(5);
  digitalWrite(10, HIGH);
  delay(50);
  bat10 = analogRead(A0);
  digitalWrite(10, LOW);
  delay(5);
  digitalWrite(11, HIGH);
  delay(50);
  bat11 = analogRead(A0);
  digitalWrite(11, LOW);
  delay(5);
  digitalWrite(12, HIGH);
  delay(50);
  bat12 = analogRead(A0);
  digitalWrite(12, LOW);
  delay(5);
  digitalWrite(13, HIGH);
  delay(50);
  bat13 = analogRead(A0);
  digitalWrite(13, LOW);
  delay(5);
  digitalWrite(14, HIGH);
  delay(50);
  bat14 = analogRead(A0);
  digitalWrite(14, LOW);
  delay(5);
  digitalWrite(15, HIGH);
  delay(50);
  bat15 = analogRead(A0);
  digitalWrite(15, LOW);
  delay(5);
  digitalWrite(16, HIGH);
  delay(50);
  bat16 = analogRead(A0);
  digitalWrite(16, LOW);
  delay(5);
  digitalWrite(17, HIGH);
  delay(50);
  bat17 = analogRead(A0);
  digitalWrite(17, LOW);
  delay(5);
  digitalWrite(18, HIGH);
  delay(50);
  bat18 = analogRead(A0);
  digitalWrite(18, LOW);
  delay(5);
  digitalWrite(19, HIGH);
  delay(50);
  bat19 = analogRead(A0);
  digitalWrite(19, LOW);
  delay(5);
  digitalWrite(20, HIGH);
  delay(50);
  bat20 = analogRead(A0);
  digitalWrite(20, LOW);
   
    //int line1 = constrain(bat1.toInt(),0,1023);
    line1 = map(bat1, 0, 1023, 300, 50);
    line2 = map(bat2, 0, 1023, 300, 50);
    line3 = map(bat3, 0, 1023, 300, 50);
    line4 = map(bat4, 0, 1023, 300, 50);
    line5 = map(bat5, 0, 1023, 300, 50);
    line6 = map(bat6, 0, 1023, 300, 50);
    line7 = map(bat7, 0, 1023, 300, 50);
    line8 = map(bat8, 0, 1023, 300, 50);
    line9 = map(bat9, 0, 1023, 300, 50);
    line10 = map(bat10, 0, 1023, 300, 50);
    line11 = map(bat11, 0, 1023, 300, 50);
    line12 = map(bat12, 0, 1023, 300, 50);
    line13 = map(bat13, 0, 1023, 300, 50);
    line14 = map(bat14, 0, 1023, 300, 50);
    line15 = map(bat15, 0, 1023, 300, 50);
    line16 = map(bat16, 0, 1023, 300, 50);
    line17 = map(bat17, 0, 1023, 300, 50);
    line18 = map(bat18, 0, 1023, 300, 50);
    line19 = map(bat19, 0, 1023, 300, 50);
    line20 = map(bat20, 0, 1023, 300, 50);
    myGLCD.setColor(VGA_BLUE);
    myGLCD.fillRect(60,0,75,line1);
    myGLCD.fillRect(80,0,95,line2);
    myGLCD.fillRect(100,0,115,line3);
    myGLCD.fillRect(120,0,135,line4);
    myGLCD.fillRect(140,10,155,line5);
    myGLCD.fillRect(160,0,175,line6);
    myGLCD.fillRect(180,0,195,line7);
    myGLCD.fillRect(200,0,215,line8);
    myGLCD.fillRect(220,0,235,line9);
    myGLCD.fillRect(240,0,255,line10);
    myGLCD.fillRect(260,0,275,line11);
    myGLCD.fillRect(280,0,295,line12);
    myGLCD.fillRect(300,0,315,line13);
    myGLCD.fillRect(320,0,335,line14);
    myGLCD.fillRect(340,0,355,line15);
    myGLCD.fillRect(360,0,375,line16);
    myGLCD.fillRect(390,0,405,line17);
    myGLCD.fillRect(410,0,425,line18);
    myGLCD.fillRect(430,0,445,line19);
    myGLCD.fillRect(450,0,465,line20);
    myGLCD.setColor(VGA_WHITE);  
    myGLCD.drawLine(55,60,470,60);
    myGLCD.drawLine(55,117,470,117);
    myGLCD.drawLine(55,255,470,255);  
    myGLCD.fillRect(60,310,75,line1);
    myGLCD.fillRect(80,310,95,line2);
    myGLCD.fillRect(100,310,115,line3);
    myGLCD.fillRect(120,310,135,line4);
    myGLCD.fillRect(140,310,155,line5);
    myGLCD.fillRect(160,310,175,line6);
    myGLCD.fillRect(180,310,195,line7);
    myGLCD.fillRect(200,310,215,line8);
    myGLCD.fillRect(220,310,235,line9);
    myGLCD.fillRect(240,310,255,line10);
    myGLCD.fillRect(260,310,275,line11);
    myGLCD.fillRect(280,310,295,line12);
    myGLCD.fillRect(300,310,315,line13);
    myGLCD.fillRect(320,310,335,line14);
    myGLCD.fillRect(340,310,355,line15);
    myGLCD.fillRect(360,310,375,line16);
    myGLCD.fillRect(390,310,405,line17);
    myGLCD.fillRect(410,310,425,line18);
    myGLCD.fillRect(430,310,445,line19);
    myGLCD.fillRect(450,310,465,line20);
    myGLCD.setFont(SmallFont);
    myGLCD.print(line1, 60, line1-10, 270);
    myGLCD.print(line2, 80, line2-10, 270);
    myGLCD.print(line3, 100, line3-10, 270);
    myGLCD.print(line4, 120, line4-10, 270);
    myGLCD.print(line5, 140, line5-10, 270);
    myGLCD.print(line6, 160, line6-10, 270);
    myGLCD.print(line7, 180, line7-10, 270);
    myGLCD.print(line8, 200, line8-10, 270);
    myGLCD.print(line9, 220, line9-10, 270);
    myGLCD.print(line10, 240, line10-10, 270);
    myGLCD.print(line11, 260, line11-10, 270);
    myGLCD.print(line12, 280, line12-10, 270);
    myGLCD.print(line13, 300, line13-10, 270);
    myGLCD.print(line14, 320, line14-10, 270);
    myGLCD.print(line15, 340, line15-10, 270);
    myGLCD.print(line16, 360, line16-10, 270);
    myGLCD.print(line17, 390, line17-10, 270);
    myGLCD.print(line182, 410, line18-10, 270);
    myGLCD.print(line19, 430, line19-10, 270);
    myGLCD.print(line20, 450, line20-10, 270);
    myGLCD.drawLine(55,60,470,60);
    myGLCD.drawLine(55,117,470,117);
    myGLCD.drawLine(55,255,470,255);
 }

line1-10 probably does not do what you think it does, whatever that is.

When you find yourself using numbers as a suffix for variable names, it is time to learn about arrays.

Sorry. line1-10 is fine when line1 is declared int or char but not when declared char *.

I do not know the answer to your question.

Success

#include <UTFT.h>
extern uint8_t BigFont[];
extern uint8_t SmallFont[];
UTFT myGLCD(CTE32HR, 38, 39, 40, 41);
int del = 30;
char buffer [4];
int Pins[] = {
  A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, 2, 3, 4, 5, 6,
};       // an array of pin numbers to which LEDs are attached
int bat[] = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
};
float batV[] = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
};
int line[] = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
};
int xbarS[] = {
  75, 95, 115, 135, 155, 175, 195, 215, 235, 255, 275, 295, 315, 335, 355, 375, 405, 425, 445, 465
};
int pinCount = 20;           // the number of pins (i.e. the length of the array)
float batsum = 0;
int high = 0;
int low = 0;
int VB = 0;
float b48;
float b12;
void setup()
{
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(Pins[thisPin], OUTPUT);
  }
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.fillScr(VGA_BLUE);
  myGLCD.setColor(VGA_WHITE);
  myGLCD.setBackColor(VGA_BLUE);
  Serial.begin(9600);
  myGLCD.setFont(SmallFont);
  myGLCD.print("1", 77, 304, 0);
  myGLCD.print("2", 97, 304, 0);
  myGLCD.print("3", 117, 304, 0);
  myGLCD.print("4", 137, 304, 0);
  myGLCD.print("5", 157, 304, 0);
  myGLCD.print("6", 177, 304, 0);
  myGLCD.print("7", 197, 304, 0);
  myGLCD.print("8", 217, 304, 0);
  myGLCD.print("9", 237, 304, 0);
  myGLCD.print("10", 253, 304, 0);
  myGLCD.print("11", 273, 304, 0);
  myGLCD.print("12", 293, 304, 0);
  myGLCD.print("13", 313, 304, 0);
  myGLCD.print("14", 333, 304, 0);
  myGLCD.print("15", 353, 304, 0);
  myGLCD.print("16", 373, 304, 0);
  myGLCD.print("17", 403, 304, 0);
  myGLCD.print("18", 423, 304, 0);
  myGLCD.print("19", 443, 304, 0);
  myGLCD.print("20", 463, 304, 0);
  myGLCD.setFont(BigFont);
  myGLCD.print("Chrg", 4
  , 52);
  myGLCD.print("100%", 4, 122);
  myGLCD.print("0%", 35, 290);
  myGLCD.setColor(VGA_RED);
  myGLCD.fillRect(70, 60, 470, 62);
  myGLCD.fillRect(70, 129, 470, 131);
  myGLCD.fillRect(70, 298, 470, 300);
  myGLCD.setColor(VGA_BLUE);
}
void loop()
{
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    digitalWrite(Pins[thisPin], HIGH);
    delay(del);
    for (int i = 0; i < 20; i++) {
      int V = analogRead(A0);
      VB = VB + V;
      delay(1);
    }
    bat[thisPin] = VB / 20;
    VB = 0;
    bat[thisPin] = constrain(bat[thisPin], 487, 858);
    batV[thisPin] = bat[thisPin];
    batV[thisPin] = map(bat[thisPin], 538, 806, 249, 373);
    batV[thisPin] = batV[thisPin] /100;
    if (thisPin < 16) {
      b48 = b48 + batV[thisPin];
    }
    else if (thisPin > 15) {
      b12 = b12 + batV[thisPin];
    }
    Serial.print(batV[thisPin]);
    Serial.print(",");
    digitalWrite(Pins[thisPin], LOW);
    int xbarF = xbarS[thisPin] + 8;
    int xbarC = xbarF + 5;
    line[thisPin] = map(bat[thisPin], 538, 806, 295, 52);
    int Ypos = line[thisPin] - 5;
    int Xpos = xbarS[thisPin] - 3;
    char buffer [5];
    dtostrf (batV[thisPin], 0, 2, buffer);
    myGLCD.setColor(VGA_BLUE);
    myGLCD.fillRect(xbarS[thisPin], 19, xbarC, 295);
    myGLCD.setColor(VGA_WHITE);
    myGLCD.fillRect(xbarS[thisPin], 300, xbarF, line[thisPin]);
    myGLCD.setFont(SmallFont);
    myGLCD.print(buffer, Xpos, Ypos, 270);
  }
  myGLCD.setFont(BigFont);
  myGLCD.printNumF(b48, 2, 190, 3);
  myGLCD.printNumF(b12, 2, 398, 3);
  myGLCD.print("v", 270, 3, 0);
  //myGLCD.print("v", 2, 438, 3);
  Serial.print(b48);
  Serial.print(",");
  Serial.print(b12);  
  Serial.print("\n");
  b48 = 0;
  b12 = 0;
}

Now, how would I make the highest and lowest bars different colors?