The constructor for the mentioned class receives as first parameter the I2C address of the device, which is 0x3c. Next, we will need to declare an object of class SSD1306, which will make available the functions needed to draw in the display. We will also need to include the SSD1306.h library, which we will use to interact with the device. To get started, we will need to include the Wire.h library, which is needed for the I2C communication with the OLED display. The code for this tutorial will be very simple since the library we have just installed has a very easy to use API. You should consult the pin mapping of your board to confirm, before proceeding with the actual connections.įigure 2 – Electric diagram between the ESP32 and the SSD1306 OLED display. Please note that depending on your development board, the names or numbers labeled on the pins may not directly match with the ones of the ESP32 microcontroller. Since the SSD1306 can operate at 3.3 V, we can use the the 3.3 V supply pin that most ESP32 boards have to power the display. We are using the ESP32 pins 21 and 22 as I2C SDA and SCL, respectively. The electric diagram can be seen below at figure 2. Thus, besides the power supply, we will only need two wires between the devices. The ESP32 will interact with the SSD1306 display via I2C. It can also be obtained as part of this starter kit. You can check here the GitHub page of the library, which details the API available to interact with the display.įor this tutorial an Elecrow’s version of the OLED was used. You can check below at figure 1 the library, which can be installed via Arduino IDE library manager. In order to facilitate the interaction with the display, we will need to install a library that supports the mentioned display model and can be used on the ESP32. The objective of this post is to explain how to connect the ESP32 to a SSD1306 OLED display and show a “Hello World” message, using the Arduino core. The objective of this post is to explain how to connect the ESP32 to a SSD1306 OLED display and print a “Hello World” message, using the Arduino core. For this tutorial, an Elecrow’s version of the OLED was used.
0 Comments
Leave a Reply. |