#include <Adafruit_SSD1306.h>
#define OLED_RESET 0 // GPIO0
#define OLED_I2C_ADDR 0x3C // set I2C-address of the OLED-Display (see datasheet)
Adafruit_SSD1306 oledDisplay(OLED_RESET); // create oled-display instance
int minuteCounter = 0; // initialize minute-counter
int secondCounter = 0; // initialize second-counter
void setup() {
// initialize oled-display
oledDisplay.begin(SSD1306_SWITCHCAPVCC, OLED_I2C_ADDR);
// set text settings
oledDisplay.setTextSize(1);
oledDisplay.setTextColor(WHITE);
}
void loop() {
oledDisplay.clearDisplay();
oledDisplay.setCursor(0,13);
oledDisplay.println("min: " + String(minuteCounter));
oledDisplay.setCursor(0,25);
oledDisplay.println("sec: " + String(secondCounter));
oledDisplay.display();
secondCounter = secondCounter + 1;
if (secondCounter == 60) {
secondCounter = 0;
minuteCounter = minuteCounter + 1;
}
delay(1000); // pause for one second (1.000 milliseconds)
}