Hellow, i have 4 voltage sensor connected to analog pins 0-3, and a i2c LCD to 4 and 5.
What I want is to set the Aref to 1.1 V for better reading precision of the sensors. My questions is: Can you confirm that i2c use analog as digital pins, so they are not affected by the reference? If yes, I have other things connected to the other digital pins (buttons/switch), they will be also not affected?
1. By default, all 20 pins of the ATmega328P of UNO are digital IO lines.
2. When Arduino takes over the control, the Port-C pins are analog channels for the internal ADC; this is the reason for the legends A0-A5 on the PCB of the UNO.
3. When you include the following lines in your sketch, the A4 and A5 lines become the SDA and SCL lines of the I2C Bus. A4 and A5 are no longer analog channels; therefore, the command analogReference(INTERNAL) has no relation with I2C Bus.
GolamMostafa:
[3. When you include the following lines in your sketch, the A4 and A5 lines become the SDA and SCL lines of the I2C Bus. A4 and A5 are no longer analog channels;
That is not true.
analogRead(A4); still reads the voltage analog and it would use the configured reference.
There is more incorrect or misleading info in the @GolamMostafa post, but that's not a surprise to me.