added simple code to the compass class to make sure the count is not
continuously running