What I think is the sequence of events: loop()loop(), loop()loop(), loop()loop(), "loop(), button press, start timer"reading=1, loop()set lastDebounceTime,loop() first if condition fails because we have to wait,loop() set lastButtonState=1","enough loop(), loop(),loop(),"loop() enough time has passed, but since no readingbutton press at in this loop(), executeiteration and the code we always do last few, reading and lastButtonState equal zero", loop(i), .e., if(0. != buttonState)).