  */
 void sdBegin(){
   if (!SD.begin(4)) {
-    Serial.println("SD failed!");
+    log("SD failed!");warn();
     return;
   }
-  Serial.println("SD done.");
+  log("SD done.");
+  #if defined(DEVMODE)
+  Serial.println("SD done");
+  #endif
 }
 /**
  * Meteorology read function
  */
 void meteorologyRead(){
   p = pressureRead();
+  l = lightRead();
+  h = humidityRead();
+  t = temperatureRead();
+  #if defined(DEVMODE)
   Serial.print("p: ");
   Serial.println(p);
-  l = lightRead();
   Serial.print("l: ");
   Serial.println(l);
-  h = humidityRead();
   Serial.print("h: ");
   Serial.println(h);
-  t = temperatureRead();
   Serial.print("t: ");
   Serial.println(t);
+  #endif
 }
 /**
  * Setup all of the configuration from the SD to the arduair
  */
-//void arduairSetup(){
-//  char character;
-//  String settingName;
-//  String settingValue;
-//  myFile = SD.open("settings.txt");
-//  if (myFile) {
-//  while (myFile.available()) {
-//  character = myFile.read();
-//  while((myFile.available()) && (character != '[')){
-//  character = myFile.read();
-//  }
-//  character = myFile.read();
-//  while((myFile.available()) && (character != '=')){
-//  settingName = settingName + character;
-//  character = myFile.read();
-//  }
-//  character = myFile.read();
-//  while((myFile.available()) && (character != ']')){
-//  settingValue = settingValue + character;
-//  character = myFile.read();
-//  }
-//  if(character == ']'){
-//
-//  /*
-//  //Debuuging Printing
-//  Serial.print("Name:");
-//  Serial.println(settingName);
-//  Serial.print("Value :");
-//  Serial.println(settingValue);
-//  */
-//
-//  // Apply the value to the parameter
-//  applySetting(settingName,settingValue);
-//  // Reset Strings
-//  settingName = "";
-//  settingValue = "";
-//  }
-//  }
-//  // close the file:
-//  myFile.close();
-//  } else {
-//  // if the file didn't open, print an error:
-//  Serial.println("error opening settings.txt");
-//  }
-//}
-///**
-// * [applySetting description]
-// * @param settingName  [description]
-// * @param settingValue [description]
-// */
-//void applySetting(String settingName, String settingValue) {
-//  if(settingName == "exINT") {
-//  exINT=settingValue.toInt();
-//  }
-//  if(settingName == "exFloat") {
-//  exFloat=toFloat(settingValue);
-//  }
-//  if(settingName == "exBoolean") {
-//  exBoolean=toBoolean(settingValue);
-//  }
-//  if(settingName == "exLong") {
-//  exLong=toLong(settingValue);
-//  }
-//  }
-//
-//  // converting string to Float
-//  float toFloat(String settingValue){
-//  char floatbuf[settingValue.length()+1];
-//  settingValue.toCharArray(floatbuf, sizeof(floatbuf));
-//  float f = atof(floatbuf);
-//  return f;
-//  }
-//
-//  long toLong(String settingValue){
-//  char longbuf[settingValue.length()+1];
-//  settingValue.toCharArray(longbuf, sizeof(longbuf));
-//  long l = atol(longbuf);
-//  return l;
-//  }
-//
-//  // Converting String to integer and then to boolean
-//  // 1 = true
-//  // 0 = false
-//  boolean toBoolean(String settingValue) {
-//  if(settingValue.toInt()==1){
-//  return true;
-//  } else {
-//  return false;
-//  }
-//}
+void arduairSetup(){
+ #if defined(DEVMODE)
+ Serial.println("Applying Settings...");
+ #endif
+ char character;
+ String settingName;
+ String settingValue;
+ myFile = SD.open("CONFIG.txt");
+ if (myFile) {
+   while (myFile.available()) {
+     character = myFile.read();
+       while((myFile.available()) && (character != '[')){
+         character = myFile.read();
+        }
+      character = myFile.read();
+      while((myFile.available()) && (character != '=')){
+        settingName = settingName + character;
+        character = myFile.read();
+      }
+      character = myFile.read();
+      while((myFile.available()) && (character != ']')){
+        settingValue = settingValue + character;
+        character = myFile.read();
+      }
+      if(character == ']'){
+
+      #if defined(DEVMODE)
+      //Debuuging Printing
+      Serial.print("Name:");
+      Serial.println(settingName);
+      Serial.print("Value :");
+      Serial.println(settingValue);
+      #endif
+
+
+       // Apply the value to the parameter
+       applySetting(settingName,settingValue);
+       // Reset Strings
+       settingName = "";
+       settingValue = "";
+     }
+   }
+ // close the file:
+ myFile.close();
+ } else {
+ // if the file didn't open, print an error:
+ #if defined(DEVMODE)
+ Serial.println("error opening settings.txt");
+ #endif
+
+ log("error opening settings.txt");
+ warn();
+ }
+ #if defined(DEVMODE)
+ Serial.println("End ArduairSetup");
+ #endif
+}
+/**
+* [applySetting description]
+* @param settingName  [description]
+* @param settingValue [description]
+*/
+void applySetting(String settingName, String settingValue) {
+  if (settingName=="network"){
+    settingValue.toCharArray(ssid,20); 
+  }
+  if (settingName=="networkpass"){
+    settingValue.toCharArray(pass,20);
+  }
+  if (settingName=="server"){
+    settingValue.toCharArray(server,20);
+  }
+  if (settingName="device"){
+    settingValue.toCharArray(device,20);
+  }
+  if (settingName=="password"){
+    settingValue.toCharArray(password,20);
+  }
+  if (settingName=="wifi"){
+    wifi==toBoolean(settingValue);
+  }
+  if (settingName=="resetclock"){
+    resetClock=toBoolean(settingValue);
+  }
+  if (settingName=="year"){
+    year=settingValue.toInt();
+  }
+  if (settingName=="month"){
+    month=settingValue.toInt();
+  }
+  if (settingName=="day"){
+    monthDay=settingValue.toInt();
+  }
+  if (settingName=="hour"){
+    hour=settingValue.toInt();
+  }
+  if (settingName=="minute"){
+    minute=settingValue.toInt();
+  }
+  if (settingName=="second"){
+    second=settingValue.toInt();
+  }
+ }
+
+ // converting string to Float
+ float toFloat(String settingValue){
+ char floatbuf[settingValue.length()+1];
+ settingValue.toCharArray(floatbuf, sizeof(floatbuf));
+ float f = atof(floatbuf);
+ return f;
+ }
+
+ long toLong(String settingValue){
+ char longbuf[settingValue.length()+1];
+ settingValue.toCharArray(longbuf, sizeof(longbuf));
+ long l = atol(longbuf);
+ return l;
+ }
+
+ // Converting String to integer and then to boolean
+ // 1 = true
+ // 0 = false
+ boolean toBoolean(String settingValue) {
+ if(settingValue.toInt()==1){
+ return true;
+ } else {
+ return false;
+ }
+}
 /**
  * This function begins wifi connection
  */
 void wifiBegin(){
+    digitalWrite(WIFIPIN,HIGH); //active wifishield
+    digitalWrite(SDPIN,LOW); //inactive SD
     // check for the presence of the shield:
     if (WiFi.status() == WL_NO_SHIELD) {
+    #if defined(DEVMODE)
     Serial.println("WiFi shield not present");
-    // don't continue:
+    #endif
+    log("WiFi shield not present");
+    warn();
     while (true);
   }
 
   String fv = WiFi.firmwareVersion();
   if (fv != "1.1.0") {
+    #if defined(DEVMODE)
     Serial.println("Please upgrade the firmware");
+    #endif
+    warn();
+    log("Please upgrade the firmware");
   }
   while (status != WL_CONNECTED) {
+    #if defined(DEVMODE)
     Serial.print("Attempting to connect to SSID: ");
     Serial.println(ssid);
+    #endif
+
     status = WiFi.begin(ssid, pass);// Connect to WPA/WPA2 network. Change this line if using open or WEP network
     delay(10000);// wait 10 seconds for connection
   }
+  #if defined(DEVMODE)
   Serial.println("Connected to wifi");
+  #endif
 }
 /**
  * Disables automatic concentration of ZE sensors and flushes Serials Buffers to prevent unexpectects behaviors from interrupts
  */
 void winsenBegin(){
+  #if defined(DEVMODE)
   Serial.println("disabling sensors");
+  #endif
   byte message[] = {0xFF,0x01, 0x78, 0x04, 0x00, 0x00, 0x00, 0x00, 0x83};//TODO: change bye array to "manual form"
   Serial1.write(message,sizeof(message));
   Serial2.write(message,sizeof(message));

 * @param {int} adress Adress of DS1307 real time clock
 */
void getDate(int adress){
  Serial.println("Getting Date");
  // Reset the register pointer
  Wire.beginTransmission(adress);
  byte zero = 0x00;

 * @param cont Contaminant to be read, could be CO, NO2 or SO2
 */
void winsenRead(int cont){
  #if defined(DEVMODE)
  Serial.println("Winsen Sensor Reading");
  #endif



  byte message[] = {0xFF,0x01, 0x78, 0x03, 0x00, 0x00, 0x00, 0x00, 0x84};
  unsigned long sampletime_ms = 30000;
