Checks periodically if a GPIO pin has reached a desired state and calls external program afterwards