diff --git a/code/table.py b/code/table.py index dfef0a9..0e8d711 100644 --- a/code/table.py +++ b/code/table.py @@ -26,7 +26,15 @@ class Table: Might return False if measuring error. """ - distance = self.hcsr04.distance_cm() + + distances = [] + + # Measure a bunch of times... + for x in range(0, 20): + distances.append(self.hcsr04.distance_cm()) + + # Take the longest distance, I've not seen any that is too far + distance = max(distances) if distance > 0: return distance