LOCODUINO

Aide
Forum de discussion
Dépôt GIT Locoduino
Flux RSS

jeudi 25 avril 2024

Visiteurs connectés : 64

La bibliothèque ScheduleTable

. Par : Jean-Luc

Devant ce constat, nous vous proposons une bibliothèque originale permettant d’ordonnancer des actions dans le temps. Nous espérons qu’elle vous facilitera la tâche. L’article a été mis à jour avec la version 1.4 de la bibliothèque. La version 1.4 apporte la compatibilité totale avec les ATTiny [1] avec l’accès aux actions sous forme d’objet. (...)

Retourner à l'article

Vous répondez à :

La bibliothèque ScheduleTable 5 janvier 2020 10:19, par Jean-Luc

Bonjour,

Voici :

#include <Servo.h>
#include <ScheduleTable.h>

SchedTable<9> porte(5000);
Servo servoB;
Servo servoH;

bool moteur1 = false;
bool moteur2 = false;
bool action = false;

const byte pinO1 = 3;
const byte pinO2 = 4;

void setup()
{
  porte.at(1,    [] { action = true; servoB.attach(7); servoH.attach(8); } );
  porte.at(100,  [] { servoB.write(0); } );
  porte.at(200,  [] { servoH.write(0); } );
  porte.at(300,  [] { digitalWrite(pinO1, HIGH); } );
  porte.at(400,  [] { moteur1 = true; } );
  porte.at(2300, [] { digitalWrite(pinO2, HIGH); } );
  porte.at(2600, [] { moteur2 = true; } );
  porte.at(2700, [] { servoH.write(170); } );
  porte.at(4700, [] { servoB.detach(); servoH.detach(); } );
}

void ouvrir()
{
  porte.start(1);
}

bool boutonPresse()
{
  return true;
}

void loop()
{
  if (boutonPresse()) ouvrir();
  
  ScheduleTable::update();
}
Qui êtes-vous ?
Votre message

Pour créer des paragraphes, laissez simplement des lignes vides.

Lien hypertexte

(Si votre message se réfère à un article publié sur le Web, ou à une page fournissant plus d’informations, vous pouvez indiquer ci-après le titre de la page et son adresse.)

14 Messages

Rubrique Bibliothèques

Bibliothèque Accessories (1)

Bibliothèque Accessories (2)

Un décodeur d’accessoires universel (1)

Un décodeur d’accessoires universel (2)

Un décodeur d’accessoires universel (3)

Bibliothèque LcdUi (1)

Bibliothèque LcdUi (2)

Bibliothèque LightEffect

La bibliothèque ACAN (2)

La bibliothèque ACAN (1)

Bibliothèque DcDccNanoController

Bibliothèque DCCpp

Bibliothèque Commanders

La bibliothèque SlowMotionServo

Bibliothèque EEPROMextent

Bibliothèque MemoryUsage

La bibliothèque ScheduleTable

Bibliothèque LCD

Bibliothèque Wire : I2C

Bibliothèque EEPROM

Bibliothèque Serial

Bibliothèque SoftWare Serial

La bibliothèque Servo

Les derniers articles

Bibliothèque LightEffect


Christian

La bibliothèque ACAN (2)


Jean-Luc

La bibliothèque ACAN (1)


Jean-Luc

La bibliothèque SlowMotionServo


Jean-Luc

Bibliothèque DCCpp


Thierry

Bibliothèque DcDccNanoController


Thierry

Bibliothèque LcdUi (2)


Thierry

Bibliothèque LcdUi (1)


Thierry

Bibliothèque Accessories (2)


Thierry

Bibliothèque Accessories (1)


Thierry

Les articles les plus lus

Bibliothèque Wire : I2C

Un décodeur d’accessoires universel (1)

Bibliothèque Commanders

La bibliothèque Servo

Bibliothèque SoftWare Serial

La bibliothèque ACAN (1)

Bibliothèque LCD

Bibliothèque DCCpp

Bibliothèque DcDccNanoController

Bibliothèque MemoryUsage