   Serial.print("PASS: ");
   Serial.println(epass);  
   
-   if (wifiConnected())
-   {
-    Serial.println("");
-    Serial.println("Connected to wifi network :/ ");
-    return;
-    } 
-
-}
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-bool wifiConnected(void) {
+  Serial.print("DHCP Enabled: ");
+  Serial.println(char(EEPROM.read(128)));
+
+  String DHCP_Enabled;
+  DHCP_Enabled = char(EEPROM.read(128));
+  if (DHCP_Enabled == "T")
+  {
+     if (wifiConnect())
+     {
+      Serial.println("");
+      Serial.println("Connected to wifi network :/ ");
+      Serial.print("IP address: ");
+      Serial.println(WiFi.localIP());
+      return;
+      } 
+  }
+  else {
+     if (wifiConnectDHCP())
+     {
+      Serial.println("");
+      Serial.println("Connected to wifi network :/ ");
+      Serial.print("IP address: ");
+      Serial.println(WiFi.localIP());
+      return;
+      } 
+  }
+  
+
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+bool wifiConnect(void) {
   WiFi.mode(WIFI_STA);
   int c = 0;
   if ( esid.length() > 1 ) {

int value = 0;
unsigned long startTime;
long timeHeld;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void connect2Wifi() {

  delay(10);
  WiFi.begin();

  Serial.println("Reading EEPROM ssid");
  

        }
        if (WiFi.status() == WL_CONNECTED) {
          Serial.println("Connected to wifi network :/ ");
          digitalWrite(SEARCH_LED, LOW);
          digitalWrite(WIFI_LED, HIGH);
          return true; 
        }
        
         
  }
  Serial.println("");
  Serial.println("Connect timed out, opening AP");
  return false;
} 
/////////////////////////////////////////////////////////////////////////////////////////////////////////
bool wifiConnectDHCP(void) {
  WiFi.mode(WIFI_STA);
  WiFi.config(staticIP, subnet, gateway, dns);
  int c = 0;
  if ( esid.length() > 1 ) {
        Serial.println("Trying to connect to wifi net..");
        WiFi.begin(esid.c_str(), epass.c_str());
        while (WiFi.status() != WL_CONNECTED&&c<20) {
          delay(500);
          Serial.print(".");
          c++;
        }
        if (WiFi.status() == WL_CONNECTED) {
          Serial.println("Connected to wifi network :/ ");
          digitalWrite(SEARCH_LED, LOW);
          digitalWrite(WIFI_LED, HIGH);
          return true; 
        }
        
