When sensor detects movement the stepper motor activates. Can be reversed by removing the ! in if cycle.