My wiring:
VDD to 3.3 V
GND to GND
SCL to SCL
SDA to SDA
ADDR to GND (resulting in an I2C address of 0x48)
A0 to GND
A1 to GND
A2 to GND
A3 to 3.3 V
I’m not doing differential measuring the connecting of the A-pins to GND and 3.3V is just for testing purpose. Different voltages from any power source result in the same error.
When I connect A3 to a voltage I get a reading for A0. When I connect A0 to a voltage I get a reading for A1. When I connect A1 I get a reading for A2 and so on.
I tried a different ADS1115 which resulted in the same error.
That would normally mean it doesn't work at all...
Besides, I2C speed is defined by the master through its SCL signal, so unless it's too fast for the slave it should be OK.
A very strange issue indeed!
Indeed, strange. Also an odd looking #define.
Would have to start digging through the library & the data sheet to maybe find an answer to why this happens. It's anyway just weird.
Its essential to add parantheses around #defines if there is any chance of the expansion interacting
with its context, given its basically textual substitution (well, almost). Single tokens don't need it,
but there's no harm in always doing it.
consider
#define ONE 1
#define TWO ONE+ONE
Serial.print (5 * TWO) ; // prints 6
should be
#define TWO (ONE+ONE)
Note that there must be a space before the '(' unless you are defining a macro when there must be
no space.
#define SQUARE(n) (n*n)
Note that this is a bad way to define squaring, as n is textually substituted and any side-effects are
duplicated!