   analogWrite(rgbrPin, pow (2, (r / R)) - 1);
   analogWrite(rgbgPin, pow (2, (g / R)) - 1);
   analogWrite(rgbbPin, pow (2, (b / R)) - 1);
+  delay(100);
   lastPhoto = analogRead(photoPin);  
   mRgb.toCharArray(lastLed, 7);
   mqttPublish(String(MQTTid) + "/Led", mRgb, 1);  

  while(!connected);
   
  //misuro la distanza
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(5);  
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin, LOW);  
  unsigned int dist = pulseIn(echoPin, HIGH, 800000) / 58; //todo vedere se si può abbassare
  if (dist == 0)
    dist = 999;
    

  lastPhoto = photo;
  
  if (alarmScattato)
    faiBeep(500);
    delay(500); //todo togliere commento
  
  if (skip % 10 == 0 && connected) { //todo trovare skip giusto
