#include <Adafruit_SSD1306.h>
#include <splash.h>

Adafruit_SSD1306 oled(128, 64, &Wire, -1);
int xc = 63;
int yc = 31;
int R = 30;
int rs = 23;
int rm = 18;
int rh = 12;
float pha = PI / 2;

// Function prototype
void drawTick(float r1, float r2, float deg, int color);

void setup() {
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3c);
  oled.clearDisplay();
  oled.drawCircle(xc, yc, 30, WHITE);
  oled.display();
  for (int i = 0; i < 360; i += 30) {
    drawTick(25, R, i, 1);
    delay(1000);
  }
}

void loop() {
  for (int m = 0; m < 60; m++) {
    for (int s = 0; s < 360; s += 6) {
      float sec = s;
      float sec_old = s - 6;
      float minute = (s * 6 / 60) + (m * 6);
      float minute_old = (((s - 6) * 6 / 60) + (m * 6));
      drawTick(0, rs, s, 1);
      drawTick(0, rs, sec_old, 0);
      drawTick(0, rm, minute, 1);
      drawTick(0, rm, minute_old, 0);
      oled.display();
      delay(1000);
    }
  }
}

void drawTick(float r1, float r2, float deg, int color) {
  int x1 = xc - (r1 * cos((deg * PI / 180) + pha));
  int y1 = yc - (r1 * sin((deg * PI / 180) + pha));
  int x2 = xc - (r2 * cos((deg * PI / 180) + pha));
  int y2 = yc - (r2 * sin((deg * PI / 180) + pha));
  oled.drawLine(x1, y1, x2, y2, color);
  oled.display();
}
$abcdeabcde151015202530fghijfghij