Stabilized distance reading by using 15 sample median

This commit is contained in:
mandlm 2017-10-16 09:14:45 +02:00
parent 140ade4ef6
commit 9d26ec5ab5

View File

@ -29,7 +29,7 @@ void DistanceThread::run()
while (true) while (true)
{ {
std::vector<double> values; std::vector<double> values;
for (int i = 0; i < 5; ++i) for (int i = 0; i < 15; ++i)
{ {
digitalWrite(m_triggerPin, HIGH); digitalWrite(m_triggerPin, HIGH);
delayMicroseconds(10); delayMicroseconds(10);