#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
int hours = 8; // CHANGE YOUR LOCAL TIME
int minutes = 35;
int seconds = 40;
char *number[12] = {"6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7"};
const int SCREEN_WIDTH = 128;
const int SCREEN_HEIGHT = 64;
float radius = min(SCREEN_HEIGHT, SCREEN_WIDTH) / 2 - 1;
const int X_CENTER = SCREEN_WIDTH / 2;
const int Y_CENTER = SCREEN_HEIGHT / 2;
void draw(void) {
// Increase OLED brightness
u8g.setContrast(255); // Set the OLED brightness to maximum
// Draw the outer circle of the clock
u8g.drawCircle(X_CENTER, Y_CENTER, radius);
// Print "Modified by Arvind" in the empty space of OLED
u8g.setFont(u8g_font_chikita);
u8g.drawStr(0, 50, "Modified ");
u8g.drawStr(0, 60, "by Arvind");
u8g.drawStr(0, 10, "TAUSEEF");
u8g.drawStr(0, 20, "AHMAD");
}
void setup(void) {
// flip screen, if required
// u8g.setRot180();
}
void loop(void) {
// Update time logic here (seconds, minutes, hours)
// Call draw() to update the clock display
// Delay as needed
seconds += 1;
if (seconds == 60) {
seconds = seconds - 60;
minutes += 1;
}
if (minutes == 60) {
minutes = 0;
hours += 1;
}
if (hours == 24) {
hours = 1;
}
// delay(800);
u8g.firstPage();
do {
draw();
} while (u8g.nextPage());
// Rebuild the picture after some delay
delay(500);
}