diff --git a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino index ea302f9..43d022f 100644 --- a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino +++ b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino @@ -23,11 +23,13 @@ void setup() lcd.print("Distance in cm"); } + + void loop() { lcd.setCursor(0,1); - lcd.print(" "); - lcd.setCursor(0,1); - lcd.print(sonar.ping_cm()); + char cm[3]; + sprintf(cm, "%.3i", sonar.ping_cm()); + lcd.print(cm); delay(50); }