Code:
extern "C" {
#include "user_interface.h" // this is for the RTC memory read/write functions
}
extern "C" {
#include "gpio.h"
}
const int DIGITAL_PIN = 15; // Digital pin to be read
const int RECV_PIN = 12; //an IR detector/demodulator is connected to GPIO pin 12
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println("Setup");
pinMode(RECV_PIN, INPUT );
pinMode(15, OUTPUT);
digitalWrite(15, LOW);
wifi_fpm_open();
wifi_fpm_set_sleep_type( LIGHT_SLEEP_T );
gpio_pin_wakeup_enable( GPIO_ID_PIN( RECV_PIN ), GPIO_PIN_INTR_LOLEVEL );
}
void loop()
{
int cnt, i;
cnt = wifi_fpm_do_sleep( 0xFFFFFFFF );
//wifi_fpm_close();
digitalWrite(15, HIGH);
delayMicroseconds(10);
digitalWrite(15, LOW);
if ( cnt ) Serial.println(cnt);
delay(50);
//wifi_fpm_open();
//wifi_fpm_set_sleep_type( LIGHT_SLEEP_T );
//gpio_pin_wakeup_enable( GPIO_ID_PIN( RECV_PIN ), GPIO_PIN_INTR_LOLEVEL );
}
Code:
extern "C" {
#include "user_interface.h" // this is for the RTC memory read/write functions
}
extern "C" {
#include "gpio.h"
}
const int DIGITAL_PIN = 15; // Digital pin to be read
const int RECV_PIN = 12; //an IR detector/demodulator is connected to GPIO pin 12
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println("Setup");
pinMode(RECV_PIN, INPUT );
pinMode(15, OUTPUT);
digitalWrite(15, LOW);
wifi_fpm_open();
wifi_fpm_set_sleep_type( LIGHT_SLEEP_T );
gpio_pin_wakeup_enable( GPIO_ID_PIN( RECV_PIN ), GPIO_PIN_INTR_LOLEVEL );
}
void loop()
{
int cnt, i;
cnt = wifi_fpm_do_sleep( 0xFFFFFFFF );
wifi_fpm_close();
digitalWrite(15, HIGH);
delayMicroseconds(10);
digitalWrite(15, LOW);
if ( cnt ) Serial.println(cnt);
delay(50);
wifi_fpm_open();
wifi_fpm_set_sleep_type( LIGHT_SLEEP_T );
gpio_pin_wakeup_enable( GPIO_ID_PIN( RECV_PIN ), GPIO_PIN_INTR_LOLEVEL );
}
Statistics: Posted by bvukov — Sun Jul 17, 2016 6:53 pm