//Force Light-sleep
extern "C" {
#include "gpio.h"
}
extern "C" {
#include "user_interface.h"
}
void setup() {
Serial.begin(115200);
Serial.println();
gpio_init(); // Initilise GPIO pins
}
void loop() {
...
delay(200);
Serial.println("Going to sleep now");
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // set sleep type
wifi_fpm_open(); // Enables force sleep
wifi_enable_gpio_wakeup(GPIO_ID_PIN(12), GPIO_PIN_INTR_LOLEVEL); //set wakeup pin
wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time
delay(200);
Serial.println("Wake up");
...
}
|