Hi. I tried to make a voltage meter with Arduino Nano and TV(I'm using TVOut lib). This is part of my code.
TV.clear_screen();
int voltage = 5/1023;
voltage = voltage * analogRead(A0);
TV.print(18,40,"VOLTAGE: ");
TV.print(voltage);
TV.print("V");
delay(10);
I'm trying to divide number 5(because max is 5V) by 1023(because the max value that can analogRead give u is 1023) and then I multiply it by analogRead(A0).
TV.clear_screen();
int voltage = 5.0/1023.0;
voltage = voltage * analogRead(A0);
TV.print(20,40,"VOLTAGE: ");
TV.print(voltage);
TV.print("V");
delay(10);