I2C communication between arduino and uvga

Every time the new and old readings are different, you have a delay. Why?

Having a non-static local variable in the loop() function means that it gets reset to 3 on every pass through loop, so every time you do not read 3 from the analog pin (no idea what is connected to it), you write to the uvga and have a 5 millisecond delay. I'm guessing that 99% of the time, the Arduino is doing nothing but waiting.