       delay(100);
   }
   Serial.println();
-
+  
+  timeClient.begin(); // start NTP time client
+ 
   // Connected!
   Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
 }
-//------------------------------------------------------------------------------------------------
-
+
+//------------------------------------------------------------------------------------------------
+//MAIN LOOP
+//------------------------------------------------------------------------------------------------
+void loop() {
+  display.clear();     // wipe display clean to refresh it
+  updateIP();          // function call for display update
+  updateTemp();        // fuction call for TMP102 temp
+  updateTime();
+  fauxmo.handle();     // call fauxmo device function
+  display.display();   // write display buffer
+  delay(10);           // loop governor, determine how fast this loop runs
+}
+//------------------------------------------------------------------------------------------------
+

#include "SSD1306.h"            // SSD1306 OLED display 
#include "Adafruit_MCP23017.h"  // Adafruit-MCP23017-Arduino-Library, GPIO EXPANDER
#include "SparkFunTMP102.h"     // TMP102 I2C temperature sensor 
#include "fauxmoESP.h"          // Alexa suppport (fake WeMo devices)

//------------------------------------------------------------------------------------------------
//VARIABLES AND GLOBALS
//------------------------------------------------------------------------------------------------

// PIN DEFINITIONS
const int I2C_SDA = 0;      //I2C bus data pin (SCL).
const int I2C_SCL = 14;     //I2C bus clock pin (SCL).
const int alertPin = 5;     //TMP102 alert pin. ESP8266 Pin 
const int relayPin_K1 = 0;  //K1 relay control pin. MCP23017 Pin 21/GPA0
const int relayPin_K2 = 1;  //K2 relay control pin. MCP23017 Pin 22/GPA1
const int relayPin_K3 = 2;  //K3 relay control pin. MCP23017 Pin 23/GPA2



//------------USB Serial Comms Setup -----------------------------------------------
  Serial.begin(baudRate);                            //start UART serial comm at global deff baudrate
  Serial.println();                                  // add two blank lines
  Serial.println();
  Serial.println("ALEXA Sprinkler Controller V1.0"); //vanity title for serial window
//----------------------------------------------------------------------------------

//------------WiFi Setup------------------------------------------------------------
 wifiSetup();     // Function call to kick off WiFi setup. 
//----------------------------------------------------------------------------------
}

//------------------------------------------------------------------------------------------------
//FUNCTIONS (SUBROUTINES)
//------------------------------------------------------------------------------------------------

//UPDATE IP FUNCTION
