OLED display is mostly used with many project and they are generally I2C based .All ESP32 chips have either I2C port or more than that and some of them even support the the software I2C that means you can softwarecally many any n on the board as I2C peripherals. So here we Interface the SSD1306 OLED display with Indusboard using its Hardware pin.
The IndusBoard has 2 I2C ports, allowing for the interfacing of multiple sensors, OLEDs, and I2C modules simultaneously. For the IndusBoard and most ESP32 chips, I2C pins can be configured either as hardware I2C or software I2C. GPIO pins 8 and 9 on the IndusBoard are configured for hardware I2C, and you can connect the OLED as follows:
5V → VCC
GND → GND
GPIO 8 → SDA
GPIO 9 → SCL
VCC → 5V
GND → GND
SDA → GPIO 8
SCL → GPIO 9
Several libraries are available in the Arduino IDE for interfacing with OLED displays. In this example, we’ll use the U8g2 library because it comes with various fonts and is compatible with different sizes and pixel configurations of OLED displays. Additionally, U8g2 supports both hardware and software I2C configurations.
Here’s a basic code snippet using the U8g2 library for a 128×64 pixel OLED display on hardware I2C pins:
Now power the Indusboard with the usba or 5V power supply usig 5V pin and you can see the display displaying texts.