From 9d26ec5ab5223c0eb5a7b4b1f99f6b1cc665b171 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 16 Oct 2017 09:14:45 +0200 Subject: [PATCH] Stabilized distance reading by using 15 sample median --- source/distancethread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/distancethread.cpp b/source/distancethread.cpp index fecd077..0df5e3d 100644 --- a/source/distancethread.cpp +++ b/source/distancethread.cpp @@ -29,7 +29,7 @@ void DistanceThread::run() while (true) { std::vector values; - for (int i = 0; i < 5; ++i) + for (int i = 0; i < 15; ++i) { digitalWrite(m_triggerPin, HIGH); delayMicroseconds(10);