Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 19, 2020 02:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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