/*Blink marco58
le bouton poussoir représente un capteur à effet Hall
un simple appui déclenche ou arrête le clignotement
*/

bool commande = false;
#include "simpleBouton.h"
simpleBouton bouton(12);//Cablage : pin---BP---GND

void setup(){
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  bouton.actualiser();
  if (bouton.vientDEtreEnfonce())
  {
    commande = !commande;
  }
  if (commande == true) {
    clignotement();
  }
  else {
    digitalWrite(LED_BUILTIN, LOW);
  }
}

void clignotement(){
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
