Hi fellows Im new in this Arduino world and I had a extrange behaviour today, I was using the Analog Input 0 for get the output of a Sharp distance sensor and all was ok, but now the Input is not working and I tested with a multimeter and the input measures a 4.7Volts, anyone have had this problem in the past?
Have you accidentally configured the pin as a digital output?
If you disconnect the signal wire from analog pin 0 and then measure the sensor wire, what voltage do you read? If it's still +4.7 then it would point to a sensor problem, no?
Lefty
Have you tried connecting the sensor to other analog pins? Perhaps you have blown the A0 pin? What voltage does the sensor use?
Try put a pull-down resistor between the analog input and the ground (anything between 100k and 1M should do the trick) and measure with multimeter again. I am wondering if there's some kind of interference.
If the problem goes away, you might want to leave the resistor there.
Thank fellows for reply so soon,
The sensor uses 5V but Im feeding it with an external Power source.
I conected the sensor to the Analog 1 and all is ok, even if I read the A0 pin with no conection the output is 1023, I will try with the resistor and I will tell you,
this is the code I am using:
void setup() {
Serial.begin(57600); //57600
}
void loop() {
// read the analog input into a variable:
int analogValue=0;
delay(5);
analogValue = analogRead(0);
Serial.println(analogValue);
delay(5); // print the result:
// wait 10 milliseconds for the analog-to-digital converter
// to settle after the last reading:
}
Are ypu ABSOLUTELY sure that the grounds of the two supplies have stayed connected ? If they are disconnected for even a short while with power on, you have a VERY good chance of blowing the input.