Periodic wakeup

dev board WeMos D1 Mini
chip ESP8266
features wakeup periodic

Before starting

Dependancies

Ensure the following requirements are available:

Pre-requisites

Try these simpler examples:

Buy the components

Description

Wake up periodically after a specified time. Short RST and GPIO012 on ESP (or D6 on WeMos).

Code

Download code
#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(115200);

  while(!Serial) { }

  Serial.println("\nI'm awake !!");
  Serial.println("Doing the task...");
  Serial.println("Going into deep sleep for 10s...");

  ESP.deepSleep(10e6);
}

void loop() {
}

Makefile

BOARD?=esp8266com:esp8266:d1_mini
PORT?=/dev/cu.wchusbserial1410
BUILD=build
# Arduino CLI version 0.14.0 is used.

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./

flash:
	arduino-cli upload --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)

clean:
	rm -r build

Arduino IDE settings

Ensure the following IDE settings before flashing.

Periodic wakeup Arduino IDE settings