Arduino left right with single input

Input only given when direction is to be changed.