void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Gilet num xx");}

void loop(){

// read the state of the pushbutton value: 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++; lcd.setCursor(0, 1); lcd.print("Dead:"); lcd.print(buttonPushCounter, DEC);

}} // save the current state as the last state, //for next time through the loop lastButtonState = buttonState;

// turns on the LED every four button pushes by // checking the modulo of the button push counter. // the modulo function gives you the remainder of // the division of two numbers: if (buttonPushCounter % 4 == 0) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }

// compare la valeur de la résistance du photorésistor de "Cible n°1 Avant" if (analogRead(lightPin0) > threshold) { // Si l'état a changé, incrémenter le compteur digitalWrite(13, LOW); // if the current state is HIGH then the button // wend from off to on: