Skip to content

Runick93/SimpleThread

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleThread

SimpleThread uses millis() as a time base, so it becomes possible to emulate simple threads or perform everyday tasks without using delay(), so the processor is releasing to perform other tasks in that interval. Tested with ESP8266-12(LoLin) and Arduino-Uno.

Compatible with the Arduino IDE 1.8.4 Library SimpleThread

Inspiration Library Metro

Installation

Create a new folder called "SimpleThread" under the folder named "libraries" in your Arduino sketchbook folder. Create the folder "libraries" in case it does not exist yet. Place all the files in the "SimpleThread" folder.

Usage

To use the library in your on sketch, select it from Sketch > Import Library.

Code example

Code basic example for ESP8266 or ARDUINO see more here examples

#include <SimpleThread.h> // Include the SimpleThread library

SimpleThread serialThread(500); // Instantiate an instance

void setup()
{
  Serial.begin(115200); // Start the Serial communication
}

void loop()
{
  if (serialThread.check())
    // check if the metro has passed it's interval .
  {
    // Output all the analog readings seperated by a space character
    Serial.print("Value read: ");
    Serial.println(analogRead(A0));
  }
}

License

The content is licensed under the MIT license. See License File for more information.

About

SimpleThread library for Arduino and ESP8266

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%