   ptr[15] = 0xFF;
 
 }
-void switchOnLight(char* ptr)
+
+void readSwitch(char* ptr){
+  ptr[12] = 0xFF;
+  ptr[15] = switchStatus;
+
+}
+
+void readLamp(char* ptr){
+  ptr[12] = 0xFF;
+  ptr[15] = lampStatus;
+
+}
+
+void switchLight(char* ptr)
 {
-  digitalWrite(led, HIGH);
+  lampStatus = ptr[16];
+  if(lampStatus == 0xFF){
+    digitalWrite(led, HIGH);
+  }
+  else{
+    digitalWrite(led, LOW);
+  }
   ptr[12] = 0xFF;
-  ptr[16] = 0xFF;
 }
-bool switchOffLight(char* ptr){
-  digitalWrite(led, LOW);
-  ptr[12] = 0xFF;
-  ptr[16] = 0xFF;
-}
+

    case 0:
      break;
    case 1:
      if (ptr[12]== 0x00){
        switchOnLight(ptr);
      }
      break;
    case 2:
      if (ptr[12]== 0x00)
      {
        switchOffLight(ptr);
      }
      break;
  }

}

  readTemp(ptr);
  readHum(ptr);
  readLum(ptr);
  readSwitch(ptr);
  readLamp(ptr);
  
}
void readTemp(char* ptr){
