Hello,
I am having some unexplained behavior attempting to read analog input to the A4 and A5 pins.
The problem began in a large code where I was using A1-A3 for analog input, but could not get the A4 pin to read using “analogRead(A4_SDA)”, but using “analogRead(A5_SCL)” instead worked as expected. All are using potentiometers as the analog source.
Since the code is large, I wanted to isolate the issue into a small code to share here in the forum, and then a whole different problem occurred. I wrote the simple code below. But in this code, A4_SDA does not read on pin A4, but rather from A1. And reading A5_SCL does not read from any pin, but follows the activity on A1.
void setup() {
Serial.begin(9600);
}
void loop() {
int read1 = analogRead(A4_SDA);
Serial.print(read1);
delay(10);
Serial.print("\t");
int read2 = analogRead(A5_SCL);
Serial.println(read2);
delay(100);
}
To recap, the behavior in my two sketches are treating pins A4 and A5 totally differently. In the large sketch, A4 does not read at all but A5 does. In the small sketch posted above, A4 reads from the A1 pin and A5 follows the behavior of A1. It is as confusing as it sounds.
Am I supposed to configure pins A4 and A5 in a special way in order to use them for analog input? Thank you.