项目介绍

peff74/ESP32-C3_OLED 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,目前获得 64 个 Star、9 次 Fork。

仓库全名
peff74/ESP32-C3_OLED
Star 数
64
Fork 数
9
未关闭 Issue
1

README 摘要

ESP32-C3OLED 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ESP32-C3_OLED 用什么语言开发?

主要使用 C++ 编写,目前有 64 个 Star。

如何获取 ESP32-C3_OLED 的源码?

可以直接克隆仓库:git clone https://github.com/peff74/ESP32-C3_OLED.git,默认分支为 main;安装与运行步骤见仓库 README。

ESP32-C3_OLED 最近还在维护吗?

仓库最近一次更新为 3 天前,当前有 1 个未关闭 Issue;Star 数为 64,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

litte Arduino code for ESP32-C3 SuperMini Board with 0.42 Inch OLED Display

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
85
价值分
41
活跃状态
活跃

语言占比

C++

贡献者

README

ESP32-C3_OLED

AHT20_BMP280 logo

  • 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 <U8g2lib.h>
#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);
}

Badge

评论

暂无评论