diff --git a/hx711.py b/hx711.py index 296b913..f42a74e 100644 --- a/hx711.py +++ b/hx711.py @@ -220,8 +220,8 @@ def read_median(self, times=3): else: # If times is even we have to take the arithmetic mean of # the two middle values. - midpoint = len(valueList) / 2 - return sum(valueList[midpoint:midpoint+2]) / 2.0 + midpoint = int(len(valueList) / 2) + return sum(valueList[midpoint-1:midpoint+1]) / 2.0 # Compatibility function, uses channel A version