2. 清除某个点 display.clearPixel
void OLEDDisplay::clearPixel(int16_t x, int16_t y)3. 显示, 显示buf区的内容 display.display
void SSD1306Wire::display()4. 把显示屏关掉 display.displayOff();
5. 把显示屏打开 display.displayOn();
6. 深度睡眠后恢复 display.allocateBuffer();
//使用它可以在深度睡眠后恢复而不重置显示(init()会做什么)。7. 关闭OLED,清除对象和缓存 display.end();
void OLEDDisplay::end()8. 屏幕垂直翻转 display.flipScreenVertically();
display.flipScreenVertically();9. 屏幕镜像显示 display.mirrorScreen();
display.mirrorScreen();10. 反色显示 display.invertDisplay();
display.invertDisplay();11. 回归正常显示 display.normalDisplay();
display.normalDisplay();12. 重新初始化 display.resetDisplay();
display.resetDisplay();13. 重置显示方向 display.resetOrientation();
display.resetOrientation();14. 设置显示亮度 display.setBrightness();
void OLEDDisplay::setBrightness(uint8_t)15. 设置对比度 display.setContrast()
void OLEDDisplay::setContrast(uint8_t contrast, uint8_t precharge = (uint8_t)'�', uint8_t comdetect = (uint8_t)'@')2. 画空心圆 display.drawCircle
void OLEDDisplay::drawCircle(int16_t x, int16_t y, int16_t radius)3. 画实心圆 display.fillCircle
void OLEDDisplay::fillCircle(int16_t x, int16_t y, int16_t radius)4. 画1/4圆弧 display.drawCircleQuads
void OLEDDisplay::drawCircleQuads(int16_t x0, int16_t y0, int16_t radius, uint8_t quads)5. 画水平线 display.drawHorizontalLine
void OLEDDisplay::drawHorizontalLine(int16_t x, int16_t y, int16_t length)6. 画垂直线 display.drawVerticalLine
void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length)7. 画线 display.drawLine
void OLEDDisplay::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1)8. 画空心矩形 display.drawRect
void OLEDDisplay::drawRect(int16_t x, int16_t y, int16_t width, int16_t height)9. 画实心矩形 display.fillRect
void OLEDDisplay::fillRect(int16_t x, int16_t y, int16_t width, int16_t height)10. 画进度条 display.drawProgressBar
void OLEDDisplay::drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress)内建字体 | 字高 | 字宽 | 包含字符 |
ArialMT_Plain_10 | 13 | 10 | 224个字符 |
ArialMT_Plain_16 | 19 | 16 | 224个字符 |
ArialMT_Plain_24 | 28 | 24 | 224个字符 |
2. 设置文本对齐方法 display.setTextAlignment()
void OLEDDisplay::setTextAlignment(OLEDDISPLAY_TEXT_ALIGNMENT textAlignment)对齐方法 | 描述 |
TEXT_ALIGN_LEFT | 左对齐 |
TEXT_ALIGN_RIGHT | 右对齐 |
TEXT_ALIGN_CENTER | 居中对齐 |
TEXT_ALIGN_CENTER_BOTH | 上下左右对齐 |
3. 绘制字符串 display.drawString
用默认或设置好的字体绘制字符串4. 绘制字符串(带最大宽度) display.drawStringMaxWidth
到达最大宽度回换行显示#include "SSD1306Wire.h"
SSD1306Wire display(0x3c, 21, 22);
const char image[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x70, 0x03, 0x18, 0x06, 0x08, 0x04, 0x08, 0x04,
0x00, 0x06, 0x80, 0x03, 0xE0, 0x00, 0xC0, 0x01, 0x00, 0x01, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, /*"未命名文件",0*/
};
void setup()
{
Serial.begin(115200);
display.init();
display.flipScreenVertically();
display.clear();
display.drawIco16x16(0, 0, image, 0);
display.display();
}
void loop()
{
}
也称作LED数码管,是一种可以显示数字和其他信息的电子设备。玻璃管中包括一个金属丝网制成的阳极和多个阴极。大部分数码管阴极的形状为数字。
在本文中,先解释 MSB(最高有效位)和 LSB(最低有效位)的概念,以及 MSBFIRST 和 LSBFIRST。然后展示了 MSBFIRST 和 LSBFIRST 的使用如何影响移位寄存器的输出。
ESP32Encoder库是一个利用ESP32脉冲计数器硬件外设实现高效旋转编码器读取的软件库。
本文对比了几款适合物联网开发的盒子硬件参数,供大家参考。
乐动掌控采用掌控板作为主控,塑胶一体式外壳,侧面和底面开具多个乐高扩展孔位,兼容乐高积木,可完成多种创意应用。
在MicroPython的ESP32库中,NVS类用于管理非易失性存储,支持 32 位有符号整数和 二进制blob。
TB6612是一款双路H桥型的直流电机驱动芯片,可以驱动两个直流电机并且控制其转速与方向,输入电压在3V~12V,因此在集成化、小型化的电机控制系统中,它可以作为理想的电机驱动器件。
Arduino-ESP32项目提供的Preferences库是一个专为ESP32设计的非易失性存储解决方案,它替代了传统的Arduino EEPROM库,提供了更强大、更可靠的数据存储功能。
本方案是一个基于ESP32-CAM + 物联网的图像采集方案。
ESP32-CAM与MicroPython结合可实现摄像头图像采集、视频流传输等功能,不过Micropython官方没有支持ESP32-CAM的固件,需要烧录第三方的专有固件。
相信很多人都有把绿植给养死的经历,可能是浇水过多、忘记浇水、较长时间不在家不能浇水等,本文介绍一种可以灵活定制的智能浇花方案。