     }
   }
 }
+
+bool readConfigFile() {
+  File f = SPIFFS.open(CONFIG_FILE, "r");
+  
+  if (!f) {
+    Serial.println("Configuration file not found");
+    return false; 
+  } else {
+    
+    size_t size = f.size();
+
+    std::unique_ptr<char[]> buf(new char[size]);
+
+   
+    f.readBytes(buf.get(), size);
+
+    f.close();
+
+    DynamicJsonBuffer jsonBuffer;
+
+    JsonObject& json = jsonBuffer.parseObject(buf.get());
+
+    if (!json.success()) {
+      Serial.println("JSON parseObject() failed");
+      return false;
+    }
+    json.printTo(Serial);
+
+    if (json.containsKey("server_ip")) {
+      server_ip = (const char*)json["server_ip"];
+    }
+  }
+  Serial.println("\nConfig file was successfully parsed");
+  return true;
+}
+
+bool writeConfigFile() {
+  Serial.println("Saving config file");
+  DynamicJsonBuffer jsonBuffer;
+  JsonObject& json = jsonBuffer.createObject();
+ 
+  json["server_ip"] = server_ip;
+
+  File f = SPIFFS.open(CONFIG_FILE, "w");
+  if (!f) {
+    Serial.println("Failed to open config file for writing");
+    return false;
+  }
+
+  json.prettyPrintTo(Serial);
+
+  json.printTo(f);
+  f.close();
+
+  Serial.println("\nConfig file was successfully saved");
+  return true;
+}
+  

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
 
const char* ssid = "TP-LINK";
const char* password = "abcd1234";
 
void setup () {
 
  Serial.begin(115200);
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
 
    delay(1000);
    Serial.print("Connecting..");
 
  }
 
}
 
void loop() {
 
  if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
 
    HTTPClient http;  //Declare an object of class HTTPClient
 

    }
 
    http.end();   //Close connection

    lastCheck = millis();
  }
}

void serialEvent() {
//    StaticJsonBuffer<200> jsonBuffer;
//    JsonObject& root = jsonBuffer.createObject();
//
//    root["uid"] = uid;
//    root["room"] = room;
//
//    char jsonBody[100];
//    root.printTo(jsonBody, root.measureLength() + 1);
//    Serial.println(jsonBody);
//    
//    HTTPClient http;
// 
//    http.begin(server_ip);
//    http.addHeader("Content-Type", "application/json");
//    
//    int httpCode = http.POST(String(jsonBody));
//    Serial.print("HTTP request send to: ");
//    Serial.println(server_ip);
//    if (httpCode == 200) { //Check the returning code
//      Serial.println("JSON Parsed succccsessfully");
//      digitalWrite(GREEN_LED_PIN, HIGH);
//      delay(1000);
//      digitalWrite(GREEN_LED_PIN, LOW);
//    } else if(httpCode == 401){
//      Serial.println("No such database entry");
//      tone(BUZZER_PIN, 800);
//      delay(1000);
//      noTone(BUZZER_PIN);
//    }else{
//      tone(BUZZER_PIN, 800);
//      delay(500);
//      noTone(BUZZER_PIN);
//      delay(200);
//      tone(BUZZER_PIN, 800);
//      delay(500);
//      noTone(BUZZER_PIN);
//      delay(200);
//      tone(BUZZER_PIN, 800);
//      delay(500);
//      noTone(BUZZER_PIN);
//    }
// 
//    http.end();   //Close connection
//    rfid.PICC_HaltA();
//
//    // Stop encryption on PCD
//    rfid.PCD_StopCrypto1(); 
//  }
  
  while (Serial.available()) {
    String data = Serial.readString();
    if(data == "Reset"){
