Ligne 79 : |
Ligne 79 : |
| distance = duration/58.2; | | distance = duration/58.2; |
| | | |
− | // | + | // Si la distance mesurée est HORS des valeurs acceptables |
| if (distance >= maximumRange || distance <= minimumRange){ | | if (distance >= maximumRange || distance <= minimumRange){ |
− | /* Send a negative number to computer and Turn LED ON
| + | /* Envoyer une valeur négative sur la liaison série. |
− | to indicate "out of range" */
| + | Activer la LED pour indiquer que l'erreur */ |
− | Serial.println("-1");
| + | Serial.println("-1"); |
− | digitalWrite(LEDPin, HIGH);
| + | digitalWrite(LEDPin, HIGH); |
| } | | } |
| else { | | else { |
− | /* Send the distance to the computer using Serial protocol, and
| + | /* Envoyer la distance vers l'ordinateur via liaison série. |
− | turn LED OFF to indicate successful reading. */
| + | Eteindre la LED pour indiquer une lecture correcte. */ |
− | Serial.println(distance);
| + | Serial.println(distance); |
− | digitalWrite(LEDPin, LOW);
| + | digitalWrite(LEDPin, LOW); |
| } | | } |
| | | |
− | //Delay 50ms before next reading. | + | //Attendre 50ms avant d'effectuer la lecture suivante. |
| delay(50); | | delay(50); |
| }</nowiki> | | }</nowiki> |