// simple project using Arduino UNO and 128x64 SSD1306 IIC OLED Display to display image
// created by upir, 2023
// youtube channel: https://www.youtube.com/upir_upir
// YOUTUBE VIDEO: https://youtu.be/Lw0Aaoo3YSY
// Links from the video:
// Inspiration: https://uxdesign.cc/designing-for-a-128x64-pixel-display-3f3361aca7a0
// 128x64 SSD1306 OLED Display 1.54": https://s.click.aliexpress.com/e/_DCYdWXb
// 128x64 SSD1306 OLED Display 0.96": https://s.click.aliexpress.com/e/_DCKdvnh
// 128x64 SSD1306 OLED Display 2.42": https://s.click.aliexpress.com/e/_DFdMoTh
// Arduino UNO: https://s.click.aliexpress.com/e/_AXDw1h
// Arduino breadboard prototyping shield: https://s.click.aliexpress.com/e/_ApbCwx
// Image2cpp (convert array to image): https://javl.github.io/image2cpp/
// Photopea (online graphics editor like Photoshop): https://www.photopea.com/
// Related videos with Arduino UNO and 128x64 OLED screen:
// Arduino OLED menu: https://youtu.be/HVHVkKt-ldc
// U8g vs U8g2: https://youtu.be/K5e0lFRvZ2E
// Arduino Parking Sensor - https://youtu.be/sEWw087KOj0
// Turbo pressure gauge with Arduino and OLED display - https://youtu.be/JXmw1xOlBdk
// Arduino Car Cluster with OLED Display - https://youtu.be/El5SJelwV_0
// Knob over OLED Display - https://youtu.be/SmbcNx7tbX8
// Arduino + OLED = 3D ? - https://youtu.be/kBAcaA7NAlA
// Arduino OLED Gauge - https://youtu.be/xI6dXTA02UQ
// Smaller & Faster Arduino - https://youtu.be/4GfPQoIRqW8
// Save Image from OLED Display to PC - https://youtu.be/Ft2pRMVm44E
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h> // library requires for IIC communication
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // initialization for the used OLED display
static const unsigned char image_Battery_bits[] U8X8_PROGMEM = {0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x3c,0x00,0x42,0x00,0x80,0x10,0x80,0x02,0x05,0x20,0x04,0x00,0x68,0x01,0x08,0x01,0x00,0x5a,0x00,0x02,0x10,0x00,0x0f,0x00};
void setup(void) {
u8g2.begin(); // start the u8g2 library
}
void loop(void) {
u8g2.clearBuffer(); // clear the internal memory
u8g2.clearBuffer();
u8g2.setFontMode(1);
u8g2.setBitmapMode(1);
u8g2.drawFrame(10, 19, 105, 25);
u8g2.drawBox(12, 22, 61, 19);
u8g2.setFont(u8g2_font_t0_11b_tr);
u8g2.drawStr(30, 57, "Battery :60%");
u8g2.drawFrame(114, 24, 5, 14);
u8g2.drawLine(2, 15, 125, 15);
u8g2.setFont(u8g2_font_6x12_tr);
u8g2.drawStr(5, 11, "Time left:-15 mins");
u8g2.drawXBM(14, 45, 26, 8, image_Battery_bits);
u8g2.sendBuffer();
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000); // one second delay, but we are only displaying a static image, so it makes no difference
}