<commit_before>![ArduinoThread Logo](https://raw.githubusercontent.com/ivanseidel/ArduinoThread/master/extras/ArduinoThread.png)

Arduino does not support "REAL" parallel tasks (aka Threads), but we can make use of this Library to
improve our code, and easily schedule tasks with fixed (or variable) time between runs.

This Library helps to maintain organized and to facilitate the use of multiple tasks. We can
use Timers Interrupts, and make it really powerfull, running "pseudo-background" tasks on the rug.

For example, I personaly use it for all my projects, and put all sensor aquisition and
filtering inside it, leaving the main loop, just for logic and "cool" part.

## Instalation

1. "Download":https://github.com/ivanseidel/ArduinoThread/archive/master.zip the Master branch from gitHub.
2. Unzip and modify the Folder name to "ArduinoThread" (Remove the '-master')
3. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software).
4. Restart Arduino IDE

**If you are here, because another Library requires this class, just don't waste time reading bellow. Install and ready.**


## Getting Started

There are many examples showing many ways to use it. Here, we will explain Class itself,
what it does and "how" it does.

There are basicaly, two Classes included in this Library:
`Thread` and `ThreadController` (that inherits from Thread).

- `Thread class`: This is the basic class, witch contains methods to set and run callbacks,
  check if the Thread should be runned, and also creates a unique ThreadID on the instantiation.

- `ThreadController class`: Responsable for "holding" multiple Threads. Can also be called
  as "a group of Threads", and is used to perform run in every Thread ONLY when needed.<commit_msg>Clarified "What" it does<commit_after>![ArduinoThread Logo](https://raw.githubusercontent.com/ivanseidel/ArduinoThread/master/extras/ArduinoThread.png)

Arduino does not support "REAL" parallel tasks (aka Threads), but we can make use of this Library to
improve our code, and easily schedule tasks with fixed (or variable) time between runs.

This Library helps to maintain organized and to facilitate the use of multiple tasks. We can
use Timers Interrupts, and make it really powerfull, running "pseudo-background" tasks under the rug.

For example, I personaly use it for all my projects, and put all sensor aquisition and
filtering inside it, leaving the main loop, just for logic and "cool" part.

#### ArduinoThreads is a library for managing the periodic execution of multiple tasks.

Blinking an LED is often the very first thing an Arduino user learns. And this demonstrates that periodically performing one single task, like toggling the LED state, is really easy. However, one may quickly discover that managing multiple periodic tasks is not so simple if the tasks have different execution periods.

ArduinoThreads is designed to simplify programs that need to perform multiple periodic tasks. The user defines a Thread object for each of those tasks, then lets the library manage their scheduled execution.

It should be noted that these are not “threads” in the real computer-science meaning of the term: tasks are implemented as functions that are periodically run to completion. On the one hand, this means that the only way a task can “yield” the CPU is by returning to the caller, and it is thus inadvisable to delay() or do long waits inside a task. On the other hand, this makes ArduinoThreads memory friendly, as no stack needs to be allocated per task.

## Instalation

1. "Download":https://github.com/ivanseidel/ArduinoThread/archive/master.zip the Master branch from gitHub.
2. Unzip and modify the Folder name to "ArduinoThread" (Remove the '-master')
3. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software).
4. Restart Arduino IDE

**If you are here, because another Library requires this class, just don't waste time reading bellow. Install and ready.**


## Getting Started

There are many examples showing many ways to use it. Here, we will explain Class itself,
what it does and "how" it does.

There are basicaly, two Classes included in this Library:
`Thread` and `ThreadController` (that inherits from Thread).

- `Thread class`: This is the basic class, witch contains methods to set and run callbacks,
  check if the Thread should be runned, and also creates a unique ThreadID on the instantiation.

- `ThreadController class`: Responsable for "holding" multiple Threads. Can also be called
  as "a group of Threads", and is used to perform run in every Thread ONLY when needed.
{'fraction_non_alphanumeric': 0.05718569286785179, 'fraction_numerical': 0.0017134289997858213, 'mean_word_length': 4.681265206812652, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5116492', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1158, 'n_words': 687}