0.91-Inch Color Screen
Module Source
Purchase Link:
https://item.taobao.com/item.htm?spm=a1z09.2.0.0.38ec2e8dwBMLLQ&id=39454653104&_u=d2t4uge5e573
Baidu Netdisk Download Link:
https://pan.baidu.com/s/1fKmD5lr4bA0WB54ukonI-A
Password:1111
Specifications
Operating Voltage: 3~5V
Operating Current: 最大16mA
Module Dimensions: 12(H) x 38(V) MM
Pixel Resolution: 128(H) x 32(V)
Driver Chip: SSD1306
Communication Protocol: IIC
Hardware Connection
The SSD1306 OLED screen typically supports I2C or SPI interfaces. Currently, we are using a screen with an I2C interface, and the following are the connection details based on this routine:
- VCC connects to the 3.3V of the development board.
- GND connects to the GND of the development board.
- SCL connects to the A5 pin of the development board (I2C clock line).
- SDA connects to the A4 pin of the development board (I2C data line). Please note that some OLED displays may include additional pins, such as RST (reset pin). If your screen has this pin, you need to connect it to a digital I/O pin on the development board and implement the reset operation in the code.
Usage Method
Installing Library Files (skip this step if already installed)
- Open the Arduino IDE.
- Go to “Tools” > “Manage Libraries…”.
- Search for “Adafruit SSD1306” and “Adafruit GFX”, and install each library individually.
Enter the code:
c
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 8, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include <Wire.h> // 包含Arduino I2C库
#include <Adafruit_GFX.h> // 包含核心图形库
#include <Adafruit_SSD1306.h> // 包含SSD1306 OLED库
// OLED屏幕的宽度和高度,根据实际情况修改
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
// 如果屏幕包含RST引脚,根据实际情况定义
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// 初始化OLED显示
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // 使用0x3C地址初始化
Serial.println(F("SSD1306 allocation failed"));
for(;;); // 不断循环
}
// 清空屏幕缓冲区
display.clearDisplay();
// 设置文本尺寸,颜色,光标位置
display.setTextSize(1); // 正常1:1像素比例
display.setTextColor(SSD1306_WHITE); // 白色文本
display.setCursor(0,10); // 在(x,y)处开始
// 显示文本
display.println(F("Hello, World!"));
// 显示屏幕缓冲区内容到OLED屏幕上
display.display();
}
void loop() {
// 在loop里面什么都不做,你可以根据需要添加自己的代码
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50