 
 void inline readLeituraAndSendToFirebase() {
     readDataToSend();
-
     if (count > DELAY_TIME_TO_SEND) {
-
         if (leitura["temperatura"] == "nan" || leitura["umidade"] == "nan" || getEpoch().toInt() <= 1000) {
+            Serial.print("Leitura falha");
             return;
         }
 
         count = 0;
         Firebase.push(TABLE_LEITURA, leitura);
+        Serial.print("Enviou leitura");
+        return;
     }
-
     if (Firebase.failed()) {
         Serial.print(getErrorString(TABLE_LEITURA));
         Serial.println(Firebase.error());
+        errorCount++;
         return;
     }
 }

    Serial.println("------Count------/");
}

void loop() {
    updateNtp();
    readMotionSensorAndSendToFirebase();

    pinMode(FANPIN, OUTPUT);
    pinMode(LIGHTPIN, OUTPUT);
    pinMode(SENSORPIN, INPUT);
    pinMode(REDPIN, OUTPUT);
    pinMode(GREENPIN, OUTPUT);
    pinMode(BLUEPIN, OUTPUT);
    
    motionSensorRead = !digitalRead(SENSORPIN);
    digitalWrite(LED_BUILTIN, !Firebase.getBool(String(DEVICE_PATH) + "light"));

}

void(* resetFunc) (void) = 0;

inline String getErrorString(String table) {
    return String(TABLE_LEITURA) + " failed to send:";
