// simple project using Arduino UNO and 128x64 SSD1306 IIC OLED Display to show battery charging indicator
// created by upir, 2023
// youtube channel: https://www.youtube.com/upir_upir
// YOUTUBE VIDEO: https://youtu.be/caHcaUoQ2kg
// SOURCE files: https://github.com/upiir/arduino_oled_battery_indicator
// Links from the video:
// 72x40 SSD1306 OLED 0.42" Display: https://s.click.aliexpress.com/e/_Ddq0EwJ
// 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 displays playlist: https://www.youtube.com/playlist?list=PLjQRaMdk7pBZ1UV3IL5ol8Qc7R9k-kwXA
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);
#define FRAME_DELAY (42)
#define FRAME_WIDTH (32)
#define FRAME_HEIGHT (32)
// 'mower', 32x32px
const unsigned char epd_bitmap_mower [] PROGMEM = {
0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe, 0x3f,
0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xf2, 0x27, 0xfe, 0x3f, 0xf0, 0x07, 0xfc, 0x1f, 0xf6, 0x37,
0xf8, 0x0f, 0xf6, 0x37, 0xe0, 0x03, 0xf0, 0x07, 0x80, 0x00, 0xf0, 0x07, 0x80, 0x00, 0xff, 0xff,
0x80, 0x00, 0xff, 0x8f, 0xe0, 0x01, 0xff, 0x07, 0xf0, 0x07, 0xfe, 0x03, 0xe0, 0x03, 0xfc, 0x01,
0x80, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x48, 0x0f, 0xc0, 0xfc, 0x48,
0x18, 0x61, 0x86, 0x30, 0x30, 0x33, 0x03, 0x00, 0x63, 0x1e, 0x31, 0x80, 0x47, 0x8c, 0x78, 0x80,
0x4c, 0xcc, 0xcc, 0x81, 0x4c, 0xcc, 0xcc, 0x83, 0x47, 0x8c, 0x78, 0x87, 0x63, 0x1e, 0x31, 0x8e,
0x30, 0x3f, 0x03, 0x00, 0xf8, 0x7f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 144)
const int epd_bitmap_allArray_LEN = 1;
const unsigned char* epd_bitmap_allArray[1] = {
epd_bitmap_mower
};
void setup(void) {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Display the splash screen (we're legally required to do so)
display.display();
}
void loop(void) {
display.clearDisplay();
display.drawBitmap(0, 0, epd_bitmap_mower, FRAME_WIDTH, FRAME_HEIGHT, 1);
display.display();
}