/* XIAO RP2040 test of OLED on the Seeeduino SIAO Expansion board Patterned after the u8g2 library HelloWorld example This works with Seeed XIAO RP2040 board package 2.7.2 Note the board type in the u8x8 constructor below. davekw7x April, 2022 */ #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), " Pass %3d", ++passno); u8g2.clearBuffer(); // clear the internal memory u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font u8g2.drawStr(0, 10, " Greetings from Aarne!"); //u8g2.drawStr(0, 10, " Hello XIAO RP2040!"); //u8g2.drawStr(0, 30, printBuffer); //u8g2.drawStr(0, 50, "Best regards,"); //u8g2.drawStr(0, 63, "davekw7x"); u8g2.sendBuffer(); // transfer internal memory to the display delay(1000); }