Arduino Mega + TFT voltage display

Hello,
This is my first big Arduino project. I am trying to get the voltage inputs of A0-13
to show up on the screen.

This is what I have so far, but I can't get the inputs to display right.

#include <UTFT.h>

extern uint8_t BigFont[];

UTFT myGLCD(ILI9486, 38, 39, 40, 41);

float Ch01=analogRead(A0);
float Ch02=analogRead(A1);
float Ch03=analogRead(A2);
int Ch04=A3;
int Ch05=A4;
int Ch06=A5;
int Ch07=A6;
int Ch08=A7;
int Ch09=A8;
int Ch10=A9;
int Ch11=A10;
int Ch12=A11;

  void setup() {
  // put your setup code here, to run once:
  
  myGLCD.InitLCD();
  myGLCD.fillScr(VGA_BLACK);
  myGLCD.setBackColor(VGA_BLACK);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
}

void loop() {
  // put your main code here, to run repeatedly:
  myGLCD.print("Test",CENTER,CENTER);
  myGLCD.print("Ch01 ",LEFT,LEFT);
  myGLCD.printNumF(Ch01,3,65,0);
  myGLCD.print("Ch02 ",LEFT,20,0);
  myGLCD.printNumF(Ch02,3,65,20);
  myGLCD.print("Ch03 ",LEFT,40,0);
  myGLCD.printNumF(Ch03,3,65,40);
  myGLCD.print("Ch04 ",LEFT,60,0);
  myGLCD.print("Ch05 ",LEFT,80,0);
  myGLCD.print("Ch06 ",LEFT,100,0);
  myGLCD.print("Ch07 ",LEFT,120,0);
  myGLCD.print("Ch08 ",LEFT,140,0);
  myGLCD.print("Ch09 ",LEFT,160,0);
  myGLCD.print("Ch10 ",LEFT,180,0);
  myGLCD.print("Ch11 ",LEFT,200,0);
  myGLCD.print("Ch12 ",LEFT,220,0);

}

Any help would be greatly appreciated! Thank you!

Why? What do you think is wrong? To me, the picture shows exactly what the program does. Hint: use arrays.

No matter what I input, it keeps reading 0.00

Publish a schema. From the information so far I can only say that the values will never change because you only read them 1 time in the beginning. You have to read them in loop().

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.