 char pass[] = "";       // your network password           //
 //---------------------------------------------------------//
 
-RtcDS3231 RTC;
 LedControl lc1 = LedControl(D5,D6,D7,1); // Initialize MAX7219
 
 // Initial set up routines

  Serial.println("  Done.");
}

// Set up the RTC.  Also loads RTC time to get time faster.
void RTCSetup() {
  RTC.Begin();

  //If RTC is still valid, set it as current time
  if (RTC.IsDateTimeValid()) {
    RtcDateTime now = RTC.GetDateTime();
    setTime(now.Hour(), now.Minute(), now.Second(), now.Day(), now.Month(), now.Year() );
  }

  //Make sure RTC is actually running...
  if (!RTC.GetIsRunning()){
    RTC.SetIsRunning(true);
  }

  //Never assume the Rtc was last configured by you, so just clear them to your needed state
  RTC.SetSquareWavePin(DS3231SquareWavePin_ModeNone);
}

// Initial set up of NTP

  connectWifi(); //Then connect to wifi
  beginNTP();    //Start up NTP Client & time keeping

  NTP.onNTPSyncEvent([](NTPSyncEvent_t ntpEvent) {
    if (ntpEvent == 0) {
      Serial.print("Got NTP time: ");
      Serial.println(NTP.getTimeDateString(NTP.getLastNTPSync()));
      RTC.set(now() );
    }
  });

  lc1.shutdown(0,false);
  lc1.setIntensity(0, 10);     //TODO: Needs moved out to seperate function.  Plus controls to raise / lower.
}

// Main program loop
void loop() {
  updateDigits(); //
  updateMisc();   //
  delay(1000);    //

  Serial.print( month() );
  Serial.print(" ");
  Serial.print( day() );
  Serial.print(" ");
  Serial.print( year() );
  Serial.print(" ");
  Serial.print( hour() );
  Serial.print(" ");
  Serial.print( minute() );
  Serial.print(" ");
  Serial.print( second() );
  Serial.println();
}

// 
