#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#include "Led.h"
#include "Square.h"

#define SCREEN_WIDTH       128  // OLED display width, in pixels
#define SCREEN_HEIGHT       64  // OLED display height, in pixels
#define OLED_RESET          -1  // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

Led mled(&display, (SCREEN_WIDTH  / 2), (SCREEN_HEIGHT  / 2));
Square squ(&display);

void setup()
{
  Serial.begin(9600);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }

  mled.init();
  display.display();
}

void loop()
{
  unsigned long curr_time = millis();
  squ.handle(curr_time);
  mled.handle(curr_time);

  // The Led Class Method only manipulates display memory
  display.display();
}



Loading
ssd1306