I have Spark-Fun Pro-Ethernet
and the analog 4,5 stop working ????
when I connect the RTC it's stuck and "freeze".
so I have wrote a simple code - just to see what there is in every analog input
and I get the same reading from 4 and 5 (nothing is connect to the output-only air....)
this is what I see on the serial :
analog 2 is 797
analog 3 is 764
analog 4 is 1020
analog 5 is 1020
this is the code :
#include "Wire.h"
void setup(){
Wire.begin();
Serial.begin(9600);
}
void loop(){
Serial.print("Analog 2 is - ");
Serial.println(analogRead(A2));
Serial.print("Analog 3 is - ");
Serial.println(analogRead(A3));
Serial.print("Analog 4 is - ");
Serial.println(analogRead(A4));
Serial.print("Analog 5 is - ");
Serial.println(analogRead(A5));
delay(1000);
}
and there is not a short circuit (A4 doesn't touch A5).
The pins A4 and A5 have dual-purpose, they are also the I2C bus (SCL and SDA). So if you use I2C device like an RTC chip you cannot use the pins for analogRead().
"James C4S" - I know that it is random , but all the time it gives the same values?
I check it for 10 min every second - and it gives the same value - this is nor make any sense.
"MarkT" - I used this Analog pins to connect RTC , but it wont show me any RTC connected.
give me 165:165:165.... like there isn't any device connected to A4 and A5. So how else can I found what is my problem?
I've seen chips with floating analog inputs that some of the floating pins would stop randomly floating and would display the analog input of another analog input pin when a voltage was applied to the other pin. It concerned me at first, but then i figured that with nothing connected to the floating pin, most any value might be possible. Maybe your floating pins are floating with another analog input with a voltage applied.
can't read analog Value when RTC connected; #2 could be software library conflict, and has nothing to do with analog readings; #3 disconnect all shields from arduino and try to test analog port alone, connecting to 0, 3.3V, 5V and see what is you getting. Than repeat for another port (5) setting (4) to ground and vice-verse.
Are there pull-up resistors on A4 and A5 to do with the RTC? That would explain reading a constant high value. Doesn't explain the RTC failing to respond though (unless its malfunctioning).
There is only one A/D converter in the arduino with only one sample and hold capacitor on the input. Therefore when you switch an outside pin to it that has nothing attached to it then it is no surprise that the A/D measure the same charge that was on that capacitor from the last time it was switched through with nothing on it.
So with nothing connected to 4 & 5 you will most likely get the same reading.