#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); // Fast I2C / TWI
// ' logo', 86x12px
const unsigned char epd_bitmap__logo [] PROGMEM = {
0xff, 0x8f, 0xf1, 0xfc, 0x3f, 0x8f, 0xf1, 0xfe, 0x7f, 0x80, 0x0c, 0xff, 0xcf, 0xf3, 0xfe, 0x7f,
0xcf, 0xf9, 0xfe, 0x7f, 0xc0, 0x0c, 0xc0, 0xcc, 0x03, 0x06, 0x60, 0xcc, 0x19, 0x80, 0x60, 0xc0,
0x00, 0xc0, 0xcc, 0x03, 0x06, 0x60, 0xcc, 0x19, 0x80, 0x60, 0xc0, 0x00, 0xc0, 0xcc, 0x03, 0x06,
0x60, 0x8c, 0x19, 0x80, 0x60, 0xc0, 0x0c, 0xff, 0x8f, 0xe3, 0xfe, 0x7f, 0x0c, 0x19, 0xfc, 0x60,
0xc0, 0x0c, 0xff, 0xcf, 0xe3, 0xfe, 0x7f, 0x0c, 0x19, 0xfc, 0x60, 0xc0, 0x0c, 0xc0, 0xcc, 0x03,
0x06, 0x60, 0x8c, 0x19, 0x80, 0x60, 0xc0, 0x0c, 0xc0, 0xcc, 0x03, 0x06, 0x60, 0xcc, 0x19, 0x80,
0x60, 0xc0, 0x0c, 0xc0, 0xcc, 0x03, 0x06, 0x60, 0xcc, 0x19, 0x80, 0x60, 0xc0, 0x0c, 0xff, 0xcf,
0xf3, 0x06, 0x60, 0xcf, 0xf9, 0xfe, 0x7f, 0xc0, 0x0c, 0xff, 0x8f, 0xf3, 0x06, 0x60, 0xcf, 0xf1,
0xfe, 0x7f, 0x8f, 0xcc
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 160)
const int epd_bitmap_allArray_LEN = 1;
const unsigned char* epd_bitmap_allArray[1] = {
epd_bitmap__logo
};
int progress = 0;
int logoVal = 0;
int menuVal = 0;
const int btUp = 2;
const int btDn = 3;
int btUpState = 0;
int btDnState = 0;
void setup() {
u8g.setFont(u8g_font_tpssb);
u8g.setColorIndex(1);
pinMode(btUp, INPUT);
pinMode(btDn, INPUT);
}
void loop() {
work();
btUpState = digitalRead(btUp);
if (btUpState == HIGH && menuVal == 1) {
menuVal = 1;
}else menuVal = 0;
}
void work(){
do {
loading();
}while(progress<86);
do {
logo();
menuVal = 0;
}while(progress >= 86);
}
void loading(){
u8g.firstPage();
do {
u8g.drawFrame(21, 20, 86, 5);
u8g.setFont(u8g_font_osb18);
u8g.drawFrame(1, 1, 124, 28);
u8g.drawBitmapP( 21, 5, 88/8, 12, epd_bitmap__logo);
u8g.drawBox(21, 20, progress, 5);
} while ( u8g.nextPage());
if (progress < 86) {
progress++;
}
}
void logo(){
u8g.firstPage();
do{
u8g.drawBitmapP( 21, 5, 88/8, 12, epd_bitmap__logo);
}while( u8g.nextPage());
}
void win1(){
u8g.firstPage();
do {
u8g.drawFrame(1, 1, 50, 8);
} while ( u8g.nextPage());
}
void win2(){
u8g.firstPage();
do {
u8g.drawFrame(1, 1, 100, 14);
} while ( u8g.nextPage());
}