// simple project using Arduino UNO and 128x64 SSD1306 IIC OLED Display to display animated icon from www.icons8.com
// created by upir, 2023
// youtube channel: https://www.youtube.com/upir_upir
// YOUTUBE VIDEO: https://youtu.be/o3PhC_VJdXo
// Links from the video:
// WOKWI animator: https://animator.wokwi.com/
// Animated icons: https://icons8.com/icons/set/popular--animated
// Infinity icon: https://icons8.com/icons/set/infinity--animated
// 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 image to c-style array): https://javl.github.io/image2cpp/
// Photopea (online graphics editor like Photoshop): https://www.photopea.com/
// Piskel Application (online animation editor): https://www.piskelapp.com/p/create/sprite
// 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 required for IIC communication
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // initialization for the used OLED display
// the arrays below are generated from the image2cpp tool, scroll down for the actual code
// 'bmp_dry_icon', 27x20px
const unsigned char bmp_dry_icon [] PROGMEM = {
0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x22, 0x00, 0xe0, 0x00, 0x22, 0x00, 0xf8, 0x03, 0x22, 0x03,
0x1f, 0x07, 0xa2, 0x04, 0x0f, 0x06, 0xa2, 0x04, 0x00, 0x60, 0xa2, 0x04, 0xe0, 0x90, 0xe2, 0x04,
0xf8, 0x93, 0x02, 0x06, 0x1f, 0x97, 0x02, 0x03, 0x0f, 0x96, 0xe3, 0x01, 0x00, 0x30, 0x20, 0x00,
0xe0, 0x60, 0x20, 0x00, 0xf8, 0xc3, 0x23, 0x00, 0x1f, 0x07, 0x22, 0x00, 0x0f, 0x06, 0x22, 0x00,
0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0xc0, 0xff, 0x01
};
// ' bmp_dry_eye_L', 45x14px
const unsigned char bmp_dry_eye_L [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff,
0xff, 0x1f, 0xff, 0x8f, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xbf,
0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xbe, 0xff, 0xff, 0xff, 0x1f,
0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00
};
// 'bmp_dry_eye_R', 45x14px
const unsigned char bmp_dry_eye_R [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xff, 0x3f,
0xc0, 0x1f, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xbf, 0xff, 0x0f, 0xff, 0xff,
0xff, 0xbf, 0xff, 0x01, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xbf, 0x0f, 0x00,
0x00, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00,
0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c
};
// 'bmp_dry_forehead_wrinkle', 60x5px
const unsigned char bmp_dry_forehead_wrinkle [] PROGMEM = {
0x00, 0x00, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00,
0x3f, 0xfc, 0xff, 0x00, 0xf0, 0xff, 0xc3, 0x0f, 0xff, 0xff, 0x01, 0x00, 0x00, 0xf8, 0xff, 0x0f,
0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00
};
void setup(void) {
u8g2.begin(); // start the u8g2 library
}
void loop(void) {
state_dry();
}
void state_dry() {
u8g2.clearBuffer(); // clear the internal memory
u8g2.drawXBMP(101, 0, 27, 20, bmp_dry_icon);
u8g2.drawXBMP(10, 40, 45, 14, bmp_dry_eye_L);
u8g2.drawXBMP(73, 40, 45, 14, bmp_dry_eye_R);
u8g2.drawXBMP(34, 21, 60, 5, bmp_dry_forehead_wrinkle);
u8g2.drawXBMP(34, 29, 60, 5, bmp_dry_forehead_wrinkle);
u8g2.sendBuffer(); // transfer internal memory to the display
}