When I use D1 and D2 for I2c connected to BME280 and a BME280 the A0 readings get erratic, some times the reading goes over 4.2 volts when the actual voltage is 4.0 the A0 reads 3.3 volts and other crazy readings the lower the actual voltage goes. Using a DVOM for actual readings.
I tried using an ADS1115 and that was even crazier.
I tried getting 10 readings at 50 msec intervals and averaging. No luck.
The code I'm using is
volt = (analogRead(0) * 4.2) / 1023;
And every variation I can think of.
Is there some bit of code to fix it?