Arduino:ESP32 + I2C SSD1306 OLED 之 Hello World

After seeing a lot of ESP32 introduction articles, I fancy its wifi and Bluetooth support, and can also use the Arduino IDE to develop, so itchy, I entered an ESP-WROOM-32 development board from a treasure to play.

Refer to this brother's article for the whole process of Arduino environment construction, and thank you here: https://blog.csdn.net/wowocpp/article/details/81428228 .

To summarize a few key points:
1. In addition to the newer version of the Arduino IDE, python2.7 must also be installed (bad news: Python 2.7 will reach the end of its life on January 1st, 2020.). Haven't tried 3.x yet.
2. Create a new directory espressif \ esp32 under C: \ Program Files (x86) \ Arduino \ hardware \;
3. Download the zip from https://github.com/espressif/arduino-esp32 and extract its contents to C: \ Program Files (x86) \ Arduino \ hardware \ espressif \ esp32 \;
4. You must run C: \ Program Files (x86) \ Arduino \ hardware \ espressif \ esp32 \ tools \ get.exe as an administrator
5. Similar UNO's 13th PIN is connected to the onboard LED. My ESP32 development board LED is the 2nd PIN. So you can change the built-in LED to 2 when flashing the blinker demo program. In addition, under the ESP32 example, there is an AnalogOut LEDSoftwareFade breathing light effect is also very interesting, can be used as a test program. Also change LED_PIN to 2.

==========

Next, you can experiment with I2C OLED.

Wiring: Vcc and GND will not say much, one 3.3V and one GND. D21 corresponds to SDA; D22 corresponds to SCL.
Driver: library management, search keyword ssd1306 esp32

Reference sample code:

#include "SSD1306.h"

SSD1306 display(0x3c, 21, 22);

void setup() {
  display.init();

  display.setFont(ArialMT_Plain_24);
  display.drawString(0, 0, "Hello World");
  display.display();
}

void loop() {
 
}

Reference materials:
https://techtutorialsx.com/2017/12/02/esp32-arduino-interacting-with-a-ssd1306-oled-display/

Published 122 original articles · Like 61 · Visits 530,000+

Guess you like

Origin blog.csdn.net/ki1381/article/details/88410605