   display.setFont(ArialMT_Plain_16);
   display.drawString(0, 0, "IP Address");
   display.drawString(0, 15, (ipaddress));
-  
+
+  /*
   if(relayState == 1){
     display.drawString(0, 30, "ALL ON");
   }
   else{
     display.drawString(0, 30, "ALL OFF");
 }
-  display.display(); //write display buffer
+  //display.display(); //write display buffer
+  */
+}
+//TEMP UPDATE FUNCTION------------------------------------------------------------------------------------------------------------------------------------
+void updateTemp(){
+  
+  float temperature;
+  String stringVal = ""; 
+  boolean alertPinState, alertRegisterState;
+
+  // read temperature data and write to OLED screen
+  temperature = sensor0.readTempF();
+  //temperature = sensor0.readTempC();
+  
+  // convert temperature float to string
+  stringVal+=String(int(temperature))+ "."+String(getDecimal(temperature)); //combining both whole and decimal part in string with a fullstop between them
+  //Serial.print("stringVal: ");Serial.println(stringVal);              //display string value
+  
+  char charVal[stringVal.length()+1];                      //initialise character array to store the values
+  stringVal.toCharArray(charVal,stringVal.length()+1);     //passing the value of the string to the character array
+  
+  //Serial.print("charVal: ");  
+  for(uint8_t i=0; i<sizeof(charVal);i++) //Serial.print(charVal[i]); //display character array
+  
+  display.setTextAlignment(TEXT_ALIGN_LEFT);
+  display.setFont(ArialMT_Plain_16);
+  display.drawString(0, 45, "TEMP:");
+  display.drawString(80, 45, "F");
+  display.drawString(48, 45, (stringVal));
+  
+  // Check for Alert
+  alertPinState = digitalRead(ALERT_PIN); // read the Alert from pin
+  alertRegisterState = sensor0.alert();   // read the Alert from register
+
+
+  /*
+  // Print temperature and alarm state
+  Serial.print("Temperature: ");
+  Serial.print(temperature);
+  
+  Serial.print("\tAlert Pin: ");
+  Serial.print(alertPinState);
+  
+  Serial.print("\tAlert Register: ");
+  Serial.println(alertRegisterState);
+  */
+}
+//function to extract decimal part of float
+long getDecimal(float val)
+{
+  int intPart = int(val);
+  long decPart = 10*(val-intPart); //I am multiplying by 1000 assuming that the foat values will have a maximum of 3 decimal places. 
+                                    //Change to match the number of decimal places you need
+  if(decPart>0)return(decPart);           //return the decimal part of float number if it is available 
+  else if(decPart<0)return((-1)*decPart); //if negative, multiply by -1
+  else if(decPart=0)return(00);           //return 0 if decimal part of float number is not available
 }
 //----------------------------------------------------------------------------------------

void setup() {

  mcp.begin();      // use default address 0 Adafruit-MCP23017-Arduino-Library
  
  display.init(); //SSD12306 init
  
  display.flipScreenVertically(); //SSD12306

#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;
