Reversing a Sketch with a button

It looks like analogRead() is for the timing.

The code seems to be missing a line

buttonState = digitalRead(buttonPin);

...R