All Projects → nrwiersma → Esp8266scheduler

nrwiersma / Esp8266scheduler

Licence: mit
ESP8266 Co-operative Multitasking

Projects that are alternatives of or similar to Esp8266scheduler

swifitch-software
Software for SWIFITCH HW
Stars: ✭ 12 (-87.1%)
Mutual labels:  esp8266, nodemcu
Esp Mqtt Json Multisensor
(OBSOLETE) ESP MQTT JSON Multisensor for Home Assistant. Supported sensors include the TEMT6000 light, AM312 PIR, DHT22 temperature/humidity sensors. RGB led supports flash, fade, and transition. Over-The-Air (OTA) uploading, too!
Stars: ✭ 323 (+247.31%)
Mutual labels:  nodemcu, esp8266
nodemcu-shell
UNIX-like ultra-lightweight Shell for NodeMCU supported devices (ESP8266, ESP32, Raspberry Pi, NanoPi, Orange Pi) written in Lua
Stars: ✭ 25 (-73.12%)
Mutual labels:  esp8266, nodemcu
thingspeak-esp-examples
ESP8266 / NodeMCU Examples for https://ThingSpeak.com
Stars: ✭ 76 (-18.28%)
Mutual labels:  esp8266, nodemcu
Nodemcu Firmware
Lua based interactive firmware for ESP8266, ESP8285 and ESP32
Stars: ✭ 6,884 (+7302.15%)
Mutual labels:  nodemcu, esp8266
n2d
An easy to use ESP8266 flash tool with built-in support for the Deauther Project.
Stars: ✭ 136 (+46.24%)
Mutual labels:  esp8266, nodemcu
Nodemcu Uploader
Upload files to your esp8266 running nodeMcu
Stars: ✭ 290 (+211.83%)
Mutual labels:  nodemcu, esp8266
Awesome Esp
📶 A curated list of awesome ESP8266/32 projects and code
Stars: ✭ 212 (+127.96%)
Mutual labels:  nodemcu, esp8266
Esp Mqtt Json Digital Leds
(OBSOLETE) ESP8266 MQTT JSON Digital LEDs for Home Assistant
Stars: ✭ 503 (+440.86%)
Mutual labels:  nodemcu, esp8266
Automated Irrigation System
This is the software of an open source automated irrigation system. The complete setup including hardware can be found in the README.
Stars: ✭ 442 (+375.27%)
Mutual labels:  nodemcu, esp8266
Jarolift MQTT
Controlling Jarolift TDEF 433MHZ radio shutters via ESP8266 and CC1101 Transceiver Module in asynchronous mode
Stars: ✭ 43 (-53.76%)
Mutual labels:  esp8266, nodemcu
Easyntpclient
Library to read time from Network Time Protocol (NTP) servers.
Stars: ✭ 20 (-78.49%)
Mutual labels:  nodemcu, esp8266
Nodemcu Tool
🔧 Upload + Manage Lua files on NodeMCU
Stars: ✭ 248 (+166.67%)
Mutual labels:  nodemcu, esp8266
blynk-sketch-generator
This repository is for generating Blynk sketches.
Stars: ✭ 20 (-78.49%)
Mutual labels:  esp8266, nodemcu
Esp Lisp
Beta: A small fast lisp interpeter for a ESP8266 as alternative to lua on the nodemcu.
Stars: ✭ 236 (+153.76%)
Mutual labels:  nodemcu, esp8266
zevoicemask
An open source DIY implemetation of a face mask with voice visuals and animations.
Stars: ✭ 13 (-86.02%)
Mutual labels:  esp8266, nodemcu
Openmqttgateway
MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility, SMS & LORA.
Stars: ✭ 2,413 (+2494.62%)
Mutual labels:  nodemcu, esp8266
Lorawangateway
A LoRaWan Gateway in LUA
Stars: ✭ 197 (+111.83%)
Mutual labels:  nodemcu, esp8266
Ideasnprojects
That Project's Source Code
Stars: ✭ 344 (+269.89%)
Mutual labels:  nodemcu, esp8266
Openwifidetectoresp8266
MASLOW: an Open WiFi Detector with ESP8266
Stars: ✭ 15 (-83.87%)
Mutual labels:  nodemcu, esp8266

Logo

Quick Start

Installing

You can install through the Arduino Library Manager. The package name is ESP8266Scheduler.

Usage

Include the library in your sketch

#include <Scheduler.h>

In your setup function start the scheduler

Scheduler.start(&task);

Scheduler.begin();

The scheduler blocks once begun, so the loop function is never called. You should instead create tasks.

Creating a Task

Tasks are classes that should inherit the Task class. A task can define a loop() and setup() function much as the normal Arduino standard.

class BlinkTask : public Task {
protected:
    void setup() {
        state = HIGH;

        pinMode(2, OUTPUT);
        digitalWrite(2, state);
    }

    void loop() {
        state = state == HIGH ? LOW : HIGH;
        digitalWrite(2, state);

        delay(1000);
    }

private:
    uint8_t state;
} blink_task;

IMPORTANT: Tasks must be declared globally on the stack (not a pointer). Failure to do so will crash your device.

Tasks can run yield and delay like they normally would. These functions yield control to the scheduler rather than the ESP8266.

Advanced Task Functions

The Task also exposes a bool shouldRun() method that is used determine if the task loop should be be resumed. This can be inherited to add your own logic to determine if your code should be resumed.

bool shouldRun() {
    bool run = Task::shouldRun();

    // Your code here

    return run;
}

This function handles the delay() logic. The parent method should be called.

Documentation

Methods

start

static void start(Task *task)

Adds a task to the multitasking queue.

begin

static void begin()

Starts the scheduler. This function is "blocking". It should be the last call the setup function.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].