
In this tutorial we will see how to display a text in an SSD1306 display with the ESP32 card:
Connecting wires
To perform the assembly, you must connect:
the SDA pin of the SSD1306 display to pin D21 of the ESP32 card
the SCL pin of the SSD1306 display to the D22 pin of the ESP32 card
the GND pin of the SSD1306 display to the GND pin of the ESP32 card
the VCC pin of the SSD1306 display to the 3.3V pin of the ESP32 card
Here is the program that displays a text on the SSD1306 display:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from machine import Pin, I2C import ssd1306 from time import sleep # ESP32 Pin assignment i2c = I2C(-1, scl=Pin(22), sda=Pin(21)) oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) oled.text('Carte', 0, 0) #Show both words 'Carte ESP32' oled.text('ESP32', 0, 10) oled.show() |
Note: the following library must be imported: ssd1306