there's no timeout afterwards to prevent action.
so i used 3 states to
- monitor the sensor to do something
- wait some time to stop doing something, and
- wait some time before monitoring the sensor
also, there's no need to attach() the servo each time
and i used running average the sensor measurement