ART-PI Getting Started: Light up the OLED display (0.96 inch four-pin IIC)

Series Article Directory

Participating in the ART-PI expansion board for a development board, in fact, I should first explain how to light up the lights. I think lighting is too simple, so I won’t write about it! Next, let's summarize the driving OLED display! The column list is as follows:

1. Add the software package corresponding to the OLED display-U8G2
The u8g2 software package is a graphics library for OLED displays. It is not only used in art-pi, but also often used in arduino and mdk.
Insert picture description here
After adding, double-click the package to modify the configuration, as shown below:
Insert picture description here

2. Configure OLED display pins
After saving the package configuration, the u8g2 folder will appear in the project. This is the package just downloaded! The next step is to modify the pins! Check the board manual and find that SCL corresponds to the H11 pin and SDA corresponds to the H12 pin. Modify the pin code:

#define OLED_I2C_PIN_SCL                    GET_PIN(H, 11) // PH11
#define OLED_I2C_PIN_SDA                    GET_PIN(H, 12)  // PH12

Add driver command header file

#include "drv_common.h"

Insert picture description here
3. Download and debug
Build the project -> download the program, open the shell terminal, enter the help command, and find that there is a new command as follows:
Insert picture description here
Yes, this is the software package just downloaded, and then you can drive the OLED display through the shell command! Just enter this command directly! But he is too long! You can use CV Dafa, of course, you can also use the Tab key to complete. After typing u, press the tab key to automatically complete the next word, and then press Enter to execute the command!
Insert picture description here
Drive and display successfully! (Because this is the expansion board that I drew, so it can be connected directly by plugging it in)
Insert picture description here
It is not difficult to find that the displayed text is actually the content of the u8g2_ssd1306_12864_sw_i2c_example function.
Insert picture description here

Guess you like

Origin blog.csdn.net/JIANGYINGH/article/details/113138796