always play in the ground function

Use a variable to hold the last reading; initialize to e.g. -1.

Do a reading and store in a variable. If the reading differs from the last reading
1)
copy current reading to last reading so it is remembered
2)
take the needed action