takes samples and averages the reading for detection

Signed-off-by: seannicholls <seannicholls@gmail.com>