Schupp

U8g test

Nov 8th, 2023 (edited)
649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // XIAO ESP32-C3 & SSD1306 0,96 Display NONAME
  2. // very impotend !!! bevor upload , boot set , reset set, sound lisen ,rest release , sound lisen , boot release  
  3. #include <Arduino.h>
  4. #include <U8g2lib.h>
  5.  
  6. #define SDA_PIN D4
  7. #define SCL_PIN D5
  8.  
  9. //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
  10. // no d10 blink , no sda , no scl , no display
  11.  
  12. U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /*clock=*/ SCL_PIN, /* data=*/ SDA_PIN, /* reset=*/ U8X8_PIN_NONE);
  13. // no d10 blink , no sda , no scl , no display
  14.  
  15. //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
  16. // ja d10 blinkt , ja sda , ja scl , display " Hello World " okay , refresh 500ms
  17.  
  18. void setup() {
  19. u8g2.setBusClock(200000);
  20.  // Wire.begin(SDA_PIN, SCL_PIN);
  21.   u8g2.begin();  
  22.  
  23. //pinMode(D4, OUTPUT);//sda
  24. //pinMode(D5, OUTPUT);//scl
  25. pinMode(D10, OUTPUT);//LED for work test
  26. }//end setup
  27.  
  28. void loop() {
  29. digitalWrite(D10, LOW);  
  30. //  delay(100);
  31.   u8g2.clearBuffer();          // clear the internal memory
  32.   u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  33.   u8g2.drawStr(0,10,"Hello 3. World!");  // write something to the internal memory
  34.   u8g2.sendBuffer();          // transfer internal memory to the display
  35. digitalWrite(D10, HIGH);  
  36.   delay(1000);  
  37. }//end loop
Advertisement
Add Comment
Please, Sign In to add comment