//Original code davekw7x https://forum.seeedstudio.com/t/arduino-boards-manager/263531/6 //Modified by Adrian Torres //Fab Academy 2023 - Fab Lab León //OLED //Fab-Xiao #include // In U8g2 library // Seeed Expansion board uses SSD1306 U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset= */ U8X8_PIN_NONE); // My breadboard has an SH1106 //U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); void setup(void) { // Change #if 0 to #if 1 to print some stuff // If you do, it will wait until you open the Serial Monitor #if 0 Serial.begin(115200); while (!Serial) {} delay(100); Serial.println("\nOLED u8g2lib test compiled on " __DATE__ " at " __TIME__); #endif u8g2.begin(); } char printBuffer[30]; uint8_t passno; void loop(void) { snprintf(printBuffer, sizeof(printBuffer), "%3d", ++passno); u8g2.clearBuffer(); // clear the internal memory u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font u8g2.drawStr(0, 10, "Hello World!"); u8g2.drawStr(0, 25, "Fab Academy 2023"); u8g2.drawStr(0, 40, "Fab-Xiao"); u8g2.drawStr(0, 55, printBuffer); u8g2.sendBuffer(); // transfer internal memory to the display delay(1000); }