change motor direction and pause at regular intervals