Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Created April 11, 2016 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/bf6b17463bdfc33803a62767496b16b9 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/bf6b17463bdfc33803a62767496b16b9 to your computer and use it in GitHub Desktop.
Adafuit_IO_REST_setup_and_loop
void setup()
{
setupWiFi();
aio.begin();
dht.begin();
float h = dht.readHumidity();
float t = dht.readTemperature();
sendDataToAdafruitIO(t,h);
// Put the board to deep sleep to save power. Will send a signal on D16 when it is time to wake up.
// Thus, connect D16 to the reset pin. After reset, setup will be executed again.
Serial.print("Going to deep sleep for ");
Serial.print(SLEEP_SECONDS);
Serial.println(" seconds");
ESP.deepSleep(SLEEP_SECONDS * 1000000);
}
void loop()
{
// nothing to do here as setup is called when waking up after deep sleep
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment