It looks like analogRead() is for the timing.
The code seems to be missing a line
buttonState = digitalRead(buttonPin);
...R
It looks like analogRead() is for the timing.
The code seems to be missing a line
buttonState = digitalRead(buttonPin);
...R