Some averaging added to try to make readings more reliable. Same code as used in YouTube alpha-testing video.