// Forum: https://forum.arduino.cc/t/problem-with-u8g2-graphics/1219126
// Same test with a classic Nano: https://wokwi.com/projects/388923767894541313
// This Wokwi project: https://wokwi.com/projects/388924275298391041
// IZOKEE_graphics.ino, D. Brooks, June 2023
#include <U8g2lib.h>
#include <Wire.h>
// Only the hardware (HW) I2C bus works for the ESP32-C3.
// Select one of these:
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,SCL,SDA,U8X8_PIN_NONE);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0,SCL,SDA,U8X8_PIN_NONE);
void setup() {
u8g2.begin();
}
void loop() {
u8g2.clearBuffer(); // Clear display.
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.setFontDirection(1); // Left-to-right, bottom-to-top "portrait" orientation.
// drawStr(Y,X,"text");
u8g2.drawStr(110,0,"Hello!");
u8g2.drawStr(95,0,"0123456789") ;
u8g2.setFont(u8g2_font_5x7_mf);
u8g2.drawStr(80,0,"small text");
u8g2.drawStr(70,0,"0123456789ABC");
u8g2.drawCircle(50,15,10);
u8g2.drawFilledEllipse(50,43,10,15);
u8g2.drawRFrame(15,20,20,30,4);
u8g2.sendBuffer(); // Transfer buffer to screen.
delay(1000);
}