Lorsqu'il détecte un mouvement le PIR passe à 3.3v (HIGH sur la broche 2)
et 0v au repos (LOW).
L'arduino compte les déclenchements et le temps
voici un extrait du code :
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter++;
Je ne souhaite pas pas utiliser l'arduino pour allumer la Led lorsque qu'il n'y a pas de déclenchement pour économiser des E/S