int sortie=13; int capteur=3; int detection; void setup() { pinMode(sortie,OUTPUT); // broche "sortie" (13) en SORTIE pinMode(capteur,INPUT); // broche "capteur" (3) en ENTREE } void loop() { detection=digitalRead(capteur); // on lit la broche capteur // la sortie OUT du capteur est active sur niveau bas while (detection==0) { // objet détecté = niveau 0 sur OUT capteur detection=digitalRead(capteur); digitalWrite(sortie,1); // on commande la sortie 13 (diode L sur la carte) } digitalWrite(sortie,0); // on éteint L dès qu'il n'y a plus detection }