#include #include LiquidCrystal_I2C lcd(0x27, 16, 2); const int PIN_IR = 2; const int PIN_BTN = 3; int compteur = 0; bool precedent = HIGH; void setup() { pinMode(PIN_IR, INPUT); pinMode(PIN_BTN, INPUT_PULLUP); lcd.init(); lcd.backlight(); lcd.setCursor(0,0); lcd.print("Passages : 0"); } void loop() { bool etat = digitalRead(PIN_IR); if (precedent == HIGH && etat == LOW) { compteur++; lcd.setCursor(0,0); lcd.print("Passages : "); lcd.print(compteur); lcd.print(" "); delay(300); } precedent = etat; if (digitalRead(PIN_BTN) == LOW) { compteur = 0; lcd.setCursor(0,0); lcd.print("Passages : 0 "); delay(500); } }