#include <U8g2lib.h> //oled库文件
#define SCL 0 //D3
#define SDA 14 //D5
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /*clock=*/SCL, /*data=*/SDA, /*reset=*/U8X8_PIN_NONE);
void setup()
{
Serial.begin(9600);
u8g2.begin();
u8g2.enableUTF8Print(); // 为Arduino print()函数启用UTF8支持
}
void oied_xs(String h1,String h2,String h3,String h4){
u8g2.setFont(u8g2_font_wqy12_t_gb2312b);//设置字体u8g2_font_wqy12_t_gb2312b
u8g2.firstPage();
do
{
u8g2.setCursor(0, 15); //指定显示位置
u8g2.print(h1); //使用print来显示字符串
u8g2.setCursor(0, 30);//指定显示位置
u8g2.print(h2);
u8g2.setCursor(0, 45); //指定显示位置
u8g2.print(h3); //使用print来显示字符串
u8g2.setCursor(0, 60); //指定显示位置
u8g2.print(h4); //使用print来显示字符串
} while (u8g2.nextPage());
}
void loop()
{
oied_xs("hllow","word","ni","hao")
delay(13000);
}