// https://wokwi.com/projects/416810674937171969
// show the RTC steaming along at real time during bogged down simulation

# include "RTClib.h"

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setupBOG(void);
void loopBOG(void);

void setup()
{
  Serial.begin(115200);
  Serial.println("\nJello Whirled!\n");

  setupRTC();
  setupBOG();
}

void setupRTC()
{
  if (!rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    abort();
  }
}

void loop()
{
  loopRTC();
  loopBOG();
}

// advance and print a counter based on millis
// advance and print a counter based on the RTC

int millisCounter;
int rtcCounter;

void loopRTC()
{
  static unsigned long lastTime;
  unsigned long ms_now = millis();

  if (ms_now - lastTime >= 1000) {
    lastTime = ms_now;
    Serial.print("millis                  ");
    Serial.println(millisCounter);
        millisCounter++;
  }

  DateTime now = rtc.now();

  static byte lastSecond;
  byte thisSecond = now.second();
  if (lastSecond != thisSecond) {
    lastSecond = thisSecond;
    Serial.print("RTC            ");
    Serial.println(rtcCounter);
        rtcCounter++;
  }
}



GND5VSDASCLSQWRTCDS1307+