Git Product home page Git Product logo

arduino-task-scheduler's Introduction

This is a task scheduler for Arduinos with AVR chips and 16 MHz oscillators. Inspired by Patterns for Time-Triggered Embedded Systems.

How to use?

STEP 1. Put Sch.init(); and Sch.start(); into void setup(), and put Sch.dispatchTasks(); into void loop(), like this:

void setup()
{
    // Your code...

    Sch.init();
    Sch.start();
}

void loop()
{
    Sch.dispatchTasks();
}

STEP 2. Put tasks at the end of your code, like this:

void setup()
{
    // Your code...

    Sch.init();
    Sch.start();
}

void loop()
{
    Sch.dispatchTasks();
}

// Tasks

void task1()
{
  // Your code...
}

void task2()
{
  // Your code...
}

STEP 3. Use Sch.addTask() between Sch.init(); and Sch.start(); to add tasks into the task scheduler, like this:

void setup()
{
    // Your code...

    Sch.init();
    
    Sch.addTask(task1,0,1000,1);  // Add task1. Starts at the 0th ms, and runs every 1000 ms
    Sch.addTask(task2,20,500,1);  // Add task2. Starts at the 20th ms, and runs every 500 ms
    
    Sch.start();
}

void loop()
{
    Sch.dispatchTasks();
}

中文简介在这里:http://blanboom.org/arduino-task-scheduler-library.html

arduino-task-scheduler's People

Contributors

blanboom avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.