Ping-Pong with a DC motor & a pot

You never actually do anything with dir or motors...

If the potentiometer values represent limits, names like MIN_something and MAX_something make more sense than two MAX_somethings.