Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // XIAO ESP32-C3 & SSD1306 0,96 Display NONAME
- // very impotend !!! bevor upload , boot set , reset set, sound lisen ,rest release , sound lisen , boot release
- #include <Arduino.h>
- #include <U8g2lib.h>
- #define SDA_PIN D4
- #define SCL_PIN D5
- //U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL_PIN, /* data=*/ SDA_PIN); // ESP32 Thing, HW I2C with pin remapping
- // no d10 blink , no sda , no scl , no display
- U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /*clock=*/ SCL_PIN, /* data=*/ SDA_PIN, /* reset=*/ U8X8_PIN_NONE);
- // no d10 blink , no sda , no scl , no display
- //U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL_PIN, /* data=*/ SDA_PIN, /* reset=*/ U8X8_PIN_NONE); // ESP32 Thing, pure SW emulated I2C
- // ja d10 blinkt , ja sda , ja scl , display " Hello World " okay , refresh 500ms
- void setup() {
- u8g2.setBusClock(200000);
- // Wire.begin(SDA_PIN, SCL_PIN);
- u8g2.begin();
- //pinMode(D4, OUTPUT);//sda
- //pinMode(D5, OUTPUT);//scl
- pinMode(D10, OUTPUT);//LED for work test
- }//end setup
- void loop() {
- digitalWrite(D10, LOW);
- // delay(100);
- u8g2.clearBuffer(); // clear the internal memory
- u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
- u8g2.drawStr(0,10,"Hello 3. World!"); // write something to the internal memory
- u8g2.sendBuffer(); // transfer internal memory to the display
- digitalWrite(D10, HIGH);
- delay(1000);
- }//end loop
Advertisement
Add Comment
Please, Sign In to add comment