Étape 5: Code
#include
Innovente lcd (12, 11, 5, 4, 3, 2) ;
#include #define TRIGGER_PIN 6 #define ECHO_PIN 7 #define MAX_DISTANCE 200 NewPing sonar (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE) ;
void setup() {lcd.begin (16, 2) ; Serial.Begin(115200) ; }
void loop() {delay(50) ; unsigned int nous = sonar.ping() ; Serial.Print ("Ping:") ; LCD.Print(US / US_ROUNDTRIP_CM) ; LCD.Print("cm") ; Delay(500) ; LCD.Clear() ; }