https://github.com/peff74/esp32-c3_oled
litte Arduino code for ESP32-C3 SuperMini Board with 0.42 Inch OLED Display
https://github.com/peff74/esp32-c3_oled
arduino arduino-sketch esp32 esp32-c3 esp32-c3-super-mini oled ssd1306
Last synced: 2 months ago
JSON representation
litte Arduino code for ESP32-C3 SuperMini Board with 0.42 Inch OLED Display
- Host: GitHub
- URL: https://github.com/peff74/esp32-c3_oled
- Owner: peff74
- Created: 2025-02-07T14:06:53.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-10-14T23:13:04.000Z (2 months ago)
- Last Synced: 2025-10-15T03:44:04.805Z (2 months ago)
- Topics: arduino, arduino-sketch, esp32, esp32-c3, esp32-c3-super-mini, oled, ssd1306
- Language: C++
- Homepage:
- Size: 2.37 MB
- Stars: 25
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ESP32-C3_OLED

- The ESP32-C3 OLED is a very practical and cheap ESP32-C3 Supermini with 0.42 Inch OLED Display.
- It is sold on all known platforms.
- Most dealers provide no technical data, which sometimes makes it difficult to get it up and running...
- The OLED display requires a workaround to function correctly because there is no dedicated 72x40 constructor in the U8g2 library.
## Technical specs
- SDA is D6
- SCL is D5
- Resolution is 72x40
## Code using U8g2
```
#include
#define OLED_RESET U8X8_PIN_NONE // Reset pin
#define OLED_SDA 5
#define OLED_SCL 6
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, OLED_RESET, OLED_SCL, OLED_SDA);
int width = 72;
int height = 40;
int xOffset = 30; // = (132-w)/2
int yOffset = 12; // = (64-h)/2
int c = 0;
void handle_oled(int c) {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_4x6_tr);
u8g2.drawStr(xOffset + 0, yOffset + 10, "Display is working!");
u8g2.drawStr(xOffset + 0, yOffset + 20, "Have fun with it");
char buffer[20];
snprintf(buffer, sizeof(buffer), "Uptime: %ds", c);
u8g2.drawStr(xOffset + 0, yOffset + 30, buffer);
u8g2.sendBuffer();
}
void setup(void) {
u8g2.begin();
u8g2.setContrast(255); // set contrast to maximum
u8g2.setBusClock(400000); //400kHz I2C
}
void loop(void) {
handle_oled(c);
c++;
delay(1000);
}
```
