I made a simple application that sleeps and when it detects GPIO13 it should wake but it does not.
#include <ESP8266WiFi.h>
extern "C" {
#include "gpio.h"
}
extern "C" {
#include "user_interface.h"
}
#define LIGHT_WAKE_PIN 13
void sleep()
{
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
gpio_pin_wakeup_enable(GPIO_ID_PIN(LIGHT_WAKE_PIN), GPIO_PIN_INTR_LOLEVEL);
wifi_fpm_do_sleep(0xFFFFFFF);
}
void setup()
{
Serial.begin(115200);
delay(100);
Serial.println("scanning for wifi");
WiFi.scanNetworks();
}
void loop()
{
delay(100);
sleep();
if(digitalRead(LIGHT_WAKE_PIN))
{
wifi_fpm_do_wakeup();
wifi_fpm_close();
Serial.println("scanning for wifi");
WiFi.scanNetworks();
}
}
I can not figure out what I am doing wrong on this, should I be using a different GPIO port? I am just not sure how to fix this. Any help would be great!