Getting out of a cycle in a for loop

Said differently, This takes 5 seconds to execute, time during which the button is not checked at all.

So you need to get rid of those delays. For extra information and examples look at

2 Likes