#include <Wire.h>
#include <U8g2lib.h>
#include <Arduino.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset= */ U8X8_PIN_NONE);

static const unsigned char image_Volup_8x6_bits[] U8X8_PROGMEM = {0x48, 0x8c, 0xaf, 0xaf, 0x8c, 0x48};
static const unsigned char image_Lock_8x8_bits[] U8X8_PROGMEM = {0x3c, 0x42, 0x42, 0xff, 0xff, 0xe7, 0xff, 0xff};
static const unsigned char image_Bluetooth_Idle_5x8_bits[] U8X8_PROGMEM = {0x04, 0x0d, 0x16, 0x0c, 0x0c, 0x16, 0x0d, 0x04};
static const unsigned char image_Alert_9x8_bits[] U8X8_PROGMEM = {0x10, 0x00, 0x38, 0x00, 0x28, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0xfe, 0x00, 0xee, 0x00, 0xff, 0x01};

int progress = 0;
char buffer[32];

void setup() {
  // put your setup code here, to run once:

  u8g2.begin();  // start the u8g2 library

}

void loop() {
  // put your main code here, to run repeatedly:

  u8g2.clearBuffer();

  u8g2.setBitmapMode(1);
  u8g2.drawFrame(11, 21, 105, 17);
  u8g2.drawBox(13, 23, progress, 13);
  u8g2.setFont(u8g2_font_helvB08_tr);
  
  sprintf(buffer, "Progress: %d%%", progress);
  u8g2.drawStr(34, 50, buffer);
  
  u8g2.setFont(u8g2_font_haxrcorp4089_tr);
  u8g2.drawStr(1, 8, "Progress Bar Screen");
  u8g2.drawLine(1, 11, 126, 11);
  u8g2.drawXBMP( 117, 2, 8, 6, image_Volup_8x6_bits);
  u8g2.drawXBMP( 95, 1, 8, 8, image_Lock_8x8_bits);
  u8g2.drawXBMP( 108, 1, 5, 8, image_Bluetooth_Idle_5x8_bits);
  u8g2.drawXBMP( 22, 42, 9, 8, image_Alert_9x8_bits);

  u8g2.sendBuffer();
  // delay(1000);

  progress++;
  if (progress > 100) {
    progress = 0;
  }

}