Skip to content

Instantly share code, notes, and snippets.

@KitWallace
Created August 30, 2012 07:53
Show Gist options
  • Save KitWallace/3523882 to your computer and use it in GitHub Desktop.
Save KitWallace/3523882 to your computer and use it in GitHub Desktop.
Smooth readings
def baroSmoother(interval_secs,smooth_secs) :
baro = baroReader(interval_secs)
max = int(smooth_secs / interval_secs)
while True:
total_baro = 0
for i in range(max) :
reading = baro.next()
total_baro += reading
average_baro = round(total_baro / max, 2)
yield(average_baro)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment