#include <Arduino.h>
#include <U8g2lib.h>
U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, 11, 10);
#define image_width 32
#define image_height 12
static unsigned char C_image_bits[] = {
0xf8,0xff,0xff,0x1f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,
0xfc,0xff,0xff,0x3f,0xf8,0xff,0xff,0x1f,0x00,0x00,0x00,0x00,
0x38,0x8e,0x71,0x1c,0x1c,0x87,0xe1,0x38,0x0e,0xc7,0xe3,0x70,
0x87,0xc3,0xc3,0xe1,0x80,0xe3,0xc7,0x01,0x00,0xe0,0x07,0x00};
static unsigned char B_image_bits[] = {
0xf8,0xff,0xff,0x1f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,
0xfc,0xff,0xff,0x3f,0xf8,0xff,0xff,0x1f,0x00,0x00,0x00,0x00,
0x38,0x8e,0x71,0x1c,0x1c,0x87,0xe1,0x38,0x00,0xc7,0xe3,0x00,
0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
static unsigned char A_image_bits[] = {
0xf8,0xff,0xff,0x1f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,
0xfc,0xff,0xff,0x3f,0xf8,0xff,0xff,0x1f,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
int circle_count = 0;
bool flag_fresh = false;
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
/*u8g2.setFont(u8g2_font_ncenB10_tr);
u8g2.drawButtonUTF8(10, 20, U8G2_BTN_BW1, 0, 0, 0, "Hello World!" );
u8g2.drawCircle(30, 30, 10, U8G2_DRAW_ALL);
u8g2.drawLine(20, 5, 5, 32);
u8g2.drawBox(105,0,16,4);
u8g2.drawLine(104, 101, 63, 63);*/
//Icon
switch(circle_count){
case 0:
u8g2.drawXBM(90, 0, image_width, image_height, A_image_bits);
flag_fresh = true;
break;
case 1:
u8g2.drawXBM(90, 0, image_width, image_height, B_image_bits);
flag_fresh = true;
break;
case 2:
u8g2.drawXBM(90, 0, image_width, image_height, C_image_bits);
flag_fresh = false;
break;
}
} while ( u8g2.nextPage() );
if (flag_fresh){
circle_count += 1;
} else {
circle_count = 0;
}
delay(300);
}