nodeMCUesp8266连接128*64OLED屏幕

    技术2025-07-29  19

    代码很简单,用u8g2自带的例程即可,屏幕是I2C的,选择对应的参数,针脚我定义到了D5和D6。屏幕一共四个端子,其中2个是电源,scl接D5,sda接D6。

    #include <Arduino.h> #include <U8g2lib.h> #include <Wire.h> U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ D5, /* data=*/ D6, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display void setup(void) { u8g2.begin(); } void loop(void) { u8g2.firstPage(); do { u8g2.setFont(u8g2_font_ncenB10_tr); u8g2.drawStr(0,24,"Hello new World!"); } while ( u8g2.nextPage() ); //delay(1000); }
    Processed: 0.012, SQL: 9