 }
 
 void OnSetRgb(){
-  cmdMessenger.sendCmd(kAcknowledge);
+  int16_t r = cmdMessenger.readInt16Arg();
+  int16_t g = cmdMessenger.readInt16Arg();
+  int16_t b = cmdMessenger.readInt16Arg();
+
+  analogWrite(PIN_LED_R, r);
+  analogWrite(PIN_LED_G, g);
+  analogWrite(PIN_LED_B, b);
+
+  cmdMessenger.sendCmdStart(kAcknowledge);
 }
 
 void OnSetR(){
-  uint16_t r = cmdMessenger.readInt16Arg();
+  int16_t r = cmdMessenger.readInt16Arg();
   analogWrite(PIN_LED_R, r);
-  cmdMessenger.sendCmd(kAcknowledge);
+  cmdMessenger.sendCmd(kAcknowledge, r);
 }
 
 void OnSetG(){
-  uint16_t g = cmdMessenger.readInt16Arg();
+  int16_t g = cmdMessenger.readInt16Arg();
   analogWrite(PIN_LED_G, g);
-  cmdMessenger.sendCmd(kAcknowledge);
+  cmdMessenger.sendCmd(kAcknowledge, g);
 }
 
 void OnSetB(){
-  uint16_t b = cmdMessenger.readInt16Arg();
+  int16_t b = cmdMessenger.readInt16Arg();
   analogWrite(PIN_LED_B, b);
-  cmdMessenger.sendCmd(kAcknowledge);
+  cmdMessenger.sendCmd(kAcknowledge, b);
 }
 
 void checkSampleTime(){
-  if( (millis() - lastSampleTime) > sampleDelay){
-    wdt_reset();
+  if( (millis() - lastSampleTime) > SAMPLE_DELAY){
     DHT.read22(PIN_DHT);  
-    wdt_reset();
     lastSampleTime = millis();
   }
 }
 
 void OnGetTemp(){
   checkSampleTime();
-  cmdMessenger.sendCmd(kAcknowledge, DHT.temperature);
+  cmdMessenger.sendCmd(kTemp, DHT.temperature);
 }
 
 void OnGetHumidity(){
   checkSampleTime();
-  cmdMessenger.sendCmd(kAcknowledge, DHT.humidity);
+  cmdMessenger.sendCmd(kHumidity, DHT.humidity);
+}
+
+void OnGetLight(){
+  uint32_t light = 0;
+  for (uint16_t i = 0; i < AVERAGE_COUNTER; i++){
+    light += analogRead(PIN_LIGHT);
+  }
+  cmdMessenger.sendCmd(kLight, light / AVERAGE_COUNTER);
 }
 
 void setup() {

  cmdMessenger.sendCmd(kAcknowledge, "Arduino ready!");
  wdt_enable(WDTO_2S);
  lastSampleTime = 0;
  analogWrite(PIN_LED_R, 255);
  analogWrite(PIN_LED_G, 255);
  analogWrite(PIN_LED_B, 255);
}

void loop() {  
  cmdMessenger.feedinSerialData();
  wdt_reset();
}



  kSetB,
  kGetTemp,
  kGetHumidity,
  kGetLight,
  kTemp,
  kHumidity,
  kLight,
  kButtonPressed,
};

void attachCommandCallbacks(){
  cmdMessenger.attach(              OnUnknownCommand);
  cmdMessenger.attach(kSetRgb,      OnSetRgb        );
  cmdMessenger.attach(kSetR,        OnSetR          );
  cmdMessenger.attach(kSetG,        OnSetG          );
  cmdMessenger.attach(kSetB,        OnSetB          );
  cmdMessenger.attach(kGetTemp,     OnGetTemp       );
  cmdMessenger.attach(kGetHumidity, OnGetHumidity   );
  cmdMessenger.attach(kGetLight,    OnGetLight      );
}

void OnUnknownCommand(){
