#include #include #include // Constructor for SSD1306 128x64 OLED with hardware I2C // U8G2_R0 = no rotation, U8X8_PIN_NONE = no reset pin U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE); static const unsigned char image_hand_thumbs_up_bits[] = { 0x00, 0x08, 0x00, 0x14, 0x00, 0x14, 0x00, 0x12, 0x00, 0x0a, 0x00, 0x09, 0x80, 0x7c, 0x5f, 0xc0, 0x31, 0xa0, 0x11, 0xc0, 0x11, 0xa0, 0x11, 0xc0, 0x11, 0xa0, 0x15, 0x40, 0x71, 0x60, 0x9f, 0x3f }; static const unsigned char image_hourglass3_bits[] = { 0x00, 0x00, 0x00, 0xe0, 0xff, 0x0f, 0x20, 0x00, 0x08, 0xc0, 0xff, 0x07, 0x80, 0x00, 0x02, 0x80, 0x00, 0x02, 0x80, 0x00, 0x02, 0x80, 0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x82, 0x00, 0x00, 0x44, 0x00, 0x00, 0x28, 0x00, 0x00, 0x28, 0x00, 0x00, 0x44, 0x00, 0x00, 0x92, 0x00, 0x00, 0x39, 0x01, 0x80, 0x7c, 0x02, 0x80, 0xfe, 0x02, 0x80, 0xfe, 0x02, 0x80, 0x00, 0x02, 0xc0, 0xff, 0x07, 0x20, 0x00, 0x08, 0xe0, 0xff, 0x0f, 0x00, 0x00, 0x00 }; void setup() { // Initialize I2C (Wire) - megaTinyCore uses default pins PA1 (SDA) and PA2 (SCL) Wire.begin(); // Initialize the display u8g2.begin(); } void loop() { u8g2.setFontMode(1); u8g2.setBitmapMode(1); u8g2.setFont(u8g2_font_6x13_tr); u8g2.clearBuffer(); u8g2.drawStr(28, 10, "Great job!"); u8g2.sendBuffer(); delay(500); u8g2.clearBuffer(); u8g2.drawXBM(40, 21, 16, 16, image_hand_thumbs_up_bits); u8g2.sendBuffer(); delay(500); u8g2.clearBuffer(); u8g2.drawXBM(47, 30, 24, 24, image_hourglass3_bits); u8g2.sendBuffer(); delay(1500); }