Repost: Serial Monitor Showing Strange Values

Hi there! Recently I ve started Arduino Programming so I am a complete beginner. In one of my projects i wanted to read the voltages from my 5V pin . I used this formula: (5./1023.)*[The value that was read]. I popped up the serial monitor just to see that it showed me i was receiving 0 Volts.
i quickly unplugged it and the monitor showed me some values close to 1V.

Here is my code

int readPin=A1;
int readVal;
float V2;
int delayT=500;

void setup() {
// put your setup code here, to run once:
pinMode(readPin,INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
readVal=analogRead(readPin);
V2=(5./1023.)*readVal;
Serial.println(V2);
delay(delayT);
}

HERE are my serial monitor readings:

The Cable plugged in the same column with the 5V pin:

15:21:34.944 -> 4.58
15:21:35.448 -> 4.57
15:21:35.961 -> 4.56

NOTHING WRONG HERE

But if plug it in as shown:

The Blue wire being the 5V;
The Red one being the one that reads (A1);
And The Black wire being the ground.

It drops back to 0 Volts.
15:21:59.475 -> 0.00
15:21:59.983 -> 0.00
15:22:00.458 -> 0.00
15:22:00.969 -> 0.00
15:22:01.478 -> 0.00

Any advice?

Please follow the advice given in the link below when posting code , use code tags and post the code here to make it easier to read and copy for examination

Schematic?

Why have you posted a duplicate topic ?

The other one has been deleted

A photo that does not show both ends of all the wires is worthless.

Written descriptions of electronic circuits are practically worthless. Schematics are the language of electronics.

How to make a schematic that you can post.

1 Like