Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 19, 2020 02:50
Show Gist options
  • Save parzibyte/917944111cde67d7da3a7966cd400e59 to your computer and use it in GitHub Desktop.
Save parzibyte/917944111cde67d7da3a7966cd400e59 to your computer and use it in GitHub Desktop.
// Si han pasado más de 5 segundos desde la última vez, enviar a Adafruit!
if (millis() - ultimaVez > TIEMPO_ESPERA)
{
humedad = sensor.readHumidity();
temperaturaEnGradosCelsius = sensor.readTemperature();
// En ocasiones puede devolver datos erróneos; por eso lo comprobamos
if (isnan(temperaturaEnGradosCelsius) || isnan(humedad))
{
ultimaVez = millis();
return;
}
temperaturaAdafruit->save(temperaturaEnGradosCelsius);
humedadAdafruit->save(humedad);
ultimaVez = millis();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment