Create a multiboot toolbox kit
They are’nt real threads, that why I’m saying emulation of threads. I’m using the TaskScheduler library :
Github : https://github.com/arkhipenko/TaskScheduler Arduino : http://playground.arduino.cc/Code/TaskScheduler Documentation :http://www.smart4smart.com/TaskScheduler.html The library allows you to :
- Run a function periodically
- Run a function a certain number of time
- Create a scheduler with priorities
- Dynamically change frequencies, iterations
- …
Launch a thread with a frequency time
#include <TaskScheduler.h>
void t2Callback();
Task t2(3000, TASK_FOREVER, &t2Callback);
Scheduler runner;
void t2Callback() {
    Serial.print("La tâche t2 se lance toutes les 3 secondes.");
}
void setup () {
  runner.init();
  runner.addTask(t2);
  t2.enable();
}
void loop () {
/* Ici on peux mettre tout autre code qui va boucler à l'infini*/
  runner.execute();
}
Launch a thread with a frequency time during a certain time
#define _TASK_SLEEP_ON_IDLE_RUN
#include <TaskScheduler.h>
int ledR=2;
Scheduler ts;
void WrapperCallback();
bool BlinkEnable();
void BlinkDisable();
void LEDON();
void LEDOFF();
/* 1 jour = 86 400 000 microsecondes*/
Task tWrapper(86400000L,TASK_FOREVER,&WrapperCallback,&ts,true); 
Task tBlink(5000,TASK_ONCE,NULL,&ts,false,&BlinkEnable,&BlinkDisable); 
/* Pendant 5 secondes*/
Task tLED(0,TASK_FOREVER,NULL,&ts,false,NULL,&LEDOFF);
/*--------------------------------*/
void WrapperCallback(){
  tBlink.restartDelayed();
}
/*----------------------------------*/
bool BlinkEnable(){
  tLED.setCallback(&LEDON);
  tLED.enable();
  return true;
}
void BlinkDisable(){
  tLED.disable();
}
void LEDON(){
            digitalWrite(ledR,HIGH);
}
void LEDOFF(){
  
      digitalWrite(ledR,LOW);
      
}
/*----------------------------------*/
void setup() {
pinMode(ledR,OUTPUT);
}
void loop() {
ts.execute();
}

 (C:)
(C:) Devops Toolchain of the website
Devops Toolchain of the website BUC & SuperBootManager U. 16.04
BUC & SuperBootManager U. 16.04 English Cheatsheet
English Cheatsheet Add an extra HDD to your laptop
Add an extra HDD to your laptop 32ch servocontroller with USB/UART
32ch servocontroller with USB/UART Replace ASUS N56XX BIOS
Replace ASUS N56XX BIOS Emulation of threads on Arduino
Emulation of threads on Arduino DIY Safety LiPo box
DIY Safety LiPo box Fix USB FlashDrive for IOS/Android
Fix USB FlashDrive for IOS/Android Secure your online privacy & data
Secure your online privacy & data Secure your computer & data
Secure your computer & data Replace HDD with SSD, iMac 9,1
Replace HDD with SSD, iMac 9,1 Create a multiboot toolbox kit
Create a multiboot toolbox kit