Thanks a bunch. I'm having it go low power and wake as expected, but from what I read, I'm not seeing setup() called after each wakeup. My loop() seems to get called instead (although I did get into the setup sleep loop once). I'm also not seeing my debug strings sent to the digistump dashboard. Could these things be related? Or could there be some floating pin?
#include "stdlib.h"
#include <ESP8266WiFi.h>
#define LED_PIN 1
#define WAKE_PIN 5
#define sleepSeconds 10
int mins = 0;
void setup()
{
pinMode(LED_PIN,OUTPUT);
delay(100); //Allow for serial print to complete.
digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(150); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
// Check to see if sleep mode selected
if (digitalRead(WAKE_PIN) == HIGH) {
Particle.publish("debug", "Entering Deep Sleep");
delay(1000);
ESP.deepSleep(sleepSeconds*1000000, WAKE_RF_DEFAULT); // Sleep
}
else {
Particle.publish("debug", "Entering Non Sleep Mode");
delay(1000);
}
} //END setup()
void loop() {
short i;
// 20 seconds of blinks
for(i=0; i<80; i++)
{
digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(150); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
}
Particle.publish("debug", "Entering loop Sleep Mode");
delay(1000);
ESP.deepSleep(sleepSeconds*1000000, WAKE_RF_DEFAULT); // Sleep
}