   Serial.println( msg[num]);
 }
 
-/*
-  void convertColors(long c)
-  {
-
-  String x = String(c, HEX);
-
-  long number = (long) strtol( &x[0], NULL, 16);
-  byte r = number >> 16;
-  byte g = number >> 8 & 0xFF;
-  byte b = number & 0xFF;
-
-  Serial.println(r , HEX);
-  Serial.println(g , HEX);
-  Serial.println(b , HEX);
-
-  //color.red = g; //verde
-  //color.green = b; //blu
-  //color.blue = r; //rosso
-
-  }
-*/
-
 void checkAwinig()
 {
   if (awning_started == true) {
-    if (millis() - 15000 > awning_starttime) {
+    if (millis() - AWRUNTIME > awning_starttime) {
       digitalWrite(10, LOW); //Disattiva il comando (fase/neutro)
-      delay(500);
       digitalWrite(11, LOW); //disattiva led tenda 1
-      delay(500);
       digitalWrite(14, LOW); //disattiva led tenda 2
       awning_started = false;
       tone(8, 4500, 100);
-      delay(400);
-      tone(8, 4500, 100);
     }
   }
   else if (awning_started == false) {
-    if (sensors[0][1] != 0 || sensors[1][1] != 0) {
+    if (sensors[0][1] == 1023 || sensors[1][1] == 1023) {
       digitalWrite(10, LOW); //Disattiva il comando (fase/neutro)
       digitalWrite(11, LOW); //disattiva led tenda 1
       digitalWrite(14, LOW); //disattiva led tenda 2
+      tone(8, 4500, 100);
     }
   }
 }

      break;
#endif

      /*
          case LEDRGB:  // TV

            convertColors(RxData[4]);

            for (uint16_t i = 0; i < LEDCOUNT; i++)
            {
              colors[i] = color;
            }
        //      ledStrip.write(colors, LEDCOUNT);

            break;
      */
  }
  actuators[actuatorId][3] = sts; //set the actuator value


      // Sensors data
      for (int i = 0; i < NUM_DATA; i++)
      {
        delay(1); //to avoid reading wrong values
        xbeeData[idx] = sensors[i][0]; //sensor number
        idx++;
        xbeeData[idx] = sensors[i][1]; //value
