#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include "image.h" // Include the image header file
// Define the OLED display width and height
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Initialize the OLED display using I2C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); // The '-1' pin parameter indicates using hardware I2C
void setup() {
// Start the display
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // 0x3C is the typical I2C address
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Loop forever if display init fails
}
display.clearDisplay(); // Clear the display
}
void loop() {
// Scroll the image across the screen
for (int x = 0; x < 256; x++) { // 256 is an arbitrary large number, should be more than the image width
display.clearDisplay(); // Clear previous frame
display.drawBitmap(-x, 0, image, 256, 64, WHITE); // Adjust these values to match the image size
display.display(); // Update the display
delay(50); // Delay to control scroll speed (increase for slower, decrease for faster)
}
}