I can’t give you an example using the Adafruit library, and that may simply be because the Adafruit library does not include support for the ESP32-S3 processor (I don’t know if that’s the case, but I tried to load the example provided in the IDE and couldn’t quickly get it to display anything on the onboard display—but I didn’t try very hard, it just didn’t work first time around, so I just went back to the Eichhorn SSD1306 library that I always use), but the following will write to two displays on the two I2C buses.
This is just the setup part of an I2C bus scanner that would normally use a single display, but with the few extra lines of code to define and write something to a second display:
#include <SSD1306.h> // OLED display
#include <Wire.h>
#define SDA 19
#define SCL 20
SSD1306 display(0x3c, SDA_OLED, SCL_OLED);
SSD1306 display2(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_TWO);
void setup()
{
Serial.begin(115200);
delay(500);
Serial.println("\nI2C Scanner");
Serial.print("SDA : ");
Serial.print(SDA);
Serial.print(", SCL: ");
Serial.println(SCL);
Serial.println();
// Initialise the OLED displays
Serial.println("[setup] Initialise display...");
pinMode(RST_OLED,OUTPUT); // GPIO16
digitalWrite(RST_OLED,LOW); // set GPIO16 low to reset OLED
delay(50);
digitalWrite(RST_OLED,HIGH);
display.init();
display.clear();
display.setFont(ArialMT_Plain_16);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(5,15,"I2C Display 1");
display.display();
display2.init();
display2.clear();
display2.setFont(ArialMT_Plain_16);
display2.setTextAlignment(TEXT_ALIGN_LEFT);
display2.drawString(5,15,"I2C Display 2");
display2.display();
}
SDA_OLED, SCL_OLED and RST_OLED are all defined in the relevant pins-arduino.h file that is automatically loaded with the board definition. I2C_TWO is defined within the SSD1306 library, which automatically handles the initialisation of both buses (which involves little more than invoking the relevant begin() method on each).
Also, I don’t know whether or not there’s a way to do a hardware reset the second display—I didn’t try—all I was trying to do was to get a simple sketch that wrote to two displays on different I2C buses.
I don’t know if this helps in your situation, but it at least demonstrates the use of two OLED displays on two separate I2C buses.