 void setup() {
 
   mcp.begin();      // use default address 0 Adafruit-MCP23017-Arduino-Library
-  
+
+//------------TMP102----------------------------------------------------------
+  pinMode(ALERT_PIN,INPUT);  // Declare alertPin as an input TMP102
+  sensor0.begin();  // Join I2C bus TMP102
+
+  // Initialize sensor0 settings
+  // These settings are saved in the sensor, even if it loses power
+  
+  // set the number of consecutive faults before triggering alarm.
+  // 0-3: 0:1 fault, 1:2 faults, 2:4 faults, 3:6 faults.
+  sensor0.setFault(3);  // Trigger alarm immediately
+  
+  // set the polarity of the Alarm. (0:Active LOW, 1:Active HIGH).
+  sensor0.setAlertPolarity(1); // Active HIGH
+  
+  // set the sensor in Comparator Mode (0) or Interrupt Mode (1).
+  sensor0.setAlertMode(0); // Comparator Mode.
+  
+  // set the Conversion Rate (how quickly the sensor gets a new reading)
+  //0-3: 0:0.25Hz, 1:1Hz, 2:4Hz, 3:8Hz
+  sensor0.setConversionRate(2);
+  
+  //set Extended Mode.
+  //0:12-bit Temperature(-55C to +128C) 1:13-bit Temperature(-55C to +150C)
+  sensor0.setExtendedMode(0);
+
+  //set T_HIGH, the upper limit to trigger the alert on
+  sensor0.setHighTempF(77.0);  // set T_HIGH in F
+  //sensor0.setHighTempC(29.4); // set T_HIGH in C
+  
+  //set T_LOW, the lower limit to shut turn off the alert
+  sensor0.setLowTempF(76.0);  // set T_LOW in F
+  //sensor0.setLowTempC(26.67); // set T_LOW in C
+//------------TMP102----------------------------------------------------------
+
   display.init(); //SSD12306 init
   
   display.flipScreenVertically(); //SSD12306

void loop() {
  display.clear(); //wipe display clean to refresh it
  updateIP(); //function call for display update
  server.handleClient(); //routine for webserver
  delay(50); // loop governor
}

#include <ESP8266mDNS.h>
#include "SSD1306.h" // SSD1306
#include "Adafruit_MCP23017.h" //Adafruit-MCP23017-Arduino-Library
#include "SparkFunTMP102.h" // Used to send and recieve specific information from our sensor

 //CONSTANTS/VARIABLES/GLOBALS-------------------------------------------------------------
const int ALERT_PIN = 5; //TMP102 alert pin
TMP102 sensor0(0x48); // Initialize sensor at I2C address 0x48

Adafruit_MCP23017 mcp; //Adafruit-MCP23017-Arduino-Library
SSD1306  display(0x3c, D3, D5); // SSD1306 Pin Assignments
MDNSResponder mdns;
