#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "frames.h"
#define SCREEN_I2C_ADDR 0x3C // or 0x3C
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RST_PIN -1 // Reset pin (-1 if not available)
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST_PIN);
// OLED Animation: android l battery
// Code auto-generated by https://wokwi.com/animator, graphics by icons8.com
#define FRAME_DELAY (42)
#define FRAME_WIDTH (64)
#define FRAME_HEIGHT (64)
#define FRAME_COUNT (sizeof(battery) / sizeof(battery[0]))
const int numFrames = sizeof(battery) / sizeof(battery[0]);
void setup() {
if (!display.begin(SCREEN_I2C_ADDR, OLED_RST_PIN)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_I2C_ADDR);
}
int frame = 0;
void loop() {
for (int i = 0; i < numFrames; i++) {
display.clearDisplay();
display.drawBitmap(0, 0, battery[i], FRAME_WIDTH, FRAME_HEIGHT, 1);
display.display();
delay(100); // Adjust the delay to control the animation speed
}
// delay(FRAME_DELAY);
}