#include <Arduino.h>
#include "U8g2lib.h"
//定义引脚
#define LED_PIN 33
#define SCL_PIN 15
#define SDA_PIN 2
U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0,SCL_PIN,SDA_PIN);
void oled_display(unsigned char index);
void setup()
{
//初始化
u8g2.begin();
u8g2.setFont(u8g2_font_6x12_tr);
pinMode(LED_PIN,OUTPUT);
Serial.begin(115200);
//u8g2.drawStr(0,10,"MUNE");
}
void loop()
{
digitalWrite(LED_PIN,HIGH);
delay(500);
digitalWrite(LED_PIN,LOW);
delay(500);
oled_display(0);
Serial.println("开始测试");
}
void oled_display(unsigned char index)
{
u8g2.firstPage();
do
{
u8g2.drawStr(0,12,"Menu");
u8g2.drawHLine(0,14,128);
}while (u8g2.nextPage());
}