From 2e9e3c5188536ffe008f92abcdc3f2116e145034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Fri, 15 Apr 2016 02:48:02 -0400 Subject: [PATCH] Takes median of 5 checks A bit ugly, but whatever --- School/vg1/Dataelektronikk/Ultrasonic Distance.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino index c6d603d..86f6b75 100644 --- a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino +++ b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino @@ -32,7 +32,7 @@ char cm[3]; void loop() { lcd.setCursor(0,1); - sprintf(cm, "%.3i", sonar.ping_cm()); + sprintf(cm, "%.3i", sonar.convert_cm(sonar.ping_median(5))); lcd.print(cm); delay(50); }