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?