hi, i’m having some issues when i try to use an sh1106 oled, with 0x3C adress( using sh1106 lib, which afaik is modified from adafruits ssd1306 library) and an elegoo ds1307 rtc module, adress 0x68 (using rtclib). both are plugged into an elegoo mega 2560
i also noticed that the rtclib library uses a 57600 baud rate for ds1307 in its example sketch but ive only been able to get a readable output at 9600.
both devices work fine when wired up by themselves, with any code that references the other commented out, but if i try to wire the sda and scl pins together and uncomment back in the code i get no output for either device.
is there a standard way for i2c devices to be wired that i’m missing?
i wrote up some stripped down code to troubleshoot it after realising the issue in the project im actually using the pieces for,
#include <RTClib.h>
#include <Adafruit_SH1106.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
//tell i2c display to use arduino reset pin
#define OLED_RESET 4
Adafruit_SH1106 display(OLED_RESET);
//init rtc module and specify days of week (possibly unnecessary)
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup() {
// put your setup code here, to run once:
//begin communication with rtc and program placeholder date+ midnight time
//unsure if date is necessary, midnight time is purposefully set on each startup to ensure timer isnt offset by last use
Serial.begin(9600);
rtc.adjust(DateTime(2022,12,5,0,0,0));
display.begin(SH1106_SWITCHCAPVCC, 0x3C);
//show and clear buffer image,
display.display();
delay(2000);
display.clearDisplay();
//prep text formatting for use and show message to visually verify
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0,0);
display.print("text test");
display.display();
delay(2000);
display.clearDisplay();//clear text
display.display();
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
Serial.print(now.year(), DEC);//print year to serial monitor to test if rtc outputs
display.setCursor(0,0);
display.print(now.year());// print year to display
display.display();
delay(2000);
display.clearDisplay();
display.display();//clear for next loop
}
wiring (using similar but not identical fritzing parts) is

