in my setup I have a SSD1306 OLED display and an ADS1115 4-channel Analog Digital Converter working on i2c. Each for it self works properly. When I bring both together the display messes up and die ADC values get worse.
@r-morgenstern, software timers are like interrupt service routines. The issue is that the I2C peripheral is unique and if the timer fires during an I2C transaction to the display, it will “clobber” that transaction while doing the ADS1115 transaction. You have two choices:
Set/reset a global “mutex” (mutual exclusivity) flag every time the timer or the display code interacts with the I2C. Check the flag prior to any I2C transaction and skip if the flag is set.
Use a non-blocking timer (using millis()) in loop() or set a flag in the software timer that you can sample in loop(). When it is set, do the ADC sampling.
I suggest the second choice since it is simple and easy to implement.