Hi everyone, I'm having problems with a project because of the Analog and Digital read with my arduino uno (Actually I have made tests with two Arduino uno, getting same problem).
The question is, is it normal to get values major to 0 (even 350, 1.5 V) in an Analog read when there is nothing connected to the analog port ? Literally the only connection to the arduino is the USB cable. Also if I connect a cable to other port (im reading A0 for example, and i connect 5V to A5), A0 starts to receive 3V.
Also, I am having problem with the digital reading because with no cables it shows 0 as reading, but just connecting a Jumper or a cable (with no voltage connection in the other side) goes crazy showing 0 and 1 sometimes.
Never before I asked myself if its normal, so thats why I'm asking.
Thank you.
The code I'm using for now is an example of arduino:
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
int sensorValue2 = analogRead (A2);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
float voltage2 = sensorValue2 * (5.0 / 1023.0);
// print out the value you read:
Serial.println("voltage A0");
Serial.println(voltage);
Serial.println("voltage A2");
Serial.println(voltage2);
delay(1500);
}