Re: Strange problem with button command and loop

Originally Posted by
CuriousOne
Also, I don't like that button should be handled in the loop with all my delays. Say I have somewhere in the code statement: pause 2000. This means, that even if I press button, I have to wait 2 seconds for software to react for it? is there a workaround for that? For example, on ZX Spectrum, if any key was pressed, the pause command, regardless of it's parameters, was terminated and next step executed immediatelly. Is same feature available here?
I don't particularly like the BUTTON command, I prefer to check it and debounce it myself.
As to the pause, instead of PAUSE 2000, do this instead:
Code:
FOR COUNTER = 1 TO 2000
PAUSE 1
***check for button press here - if pressed EXIT***
NEXT COUNTER
That way, you are checking every millisecond for a button press. Of course you can adjust this to check as often or seldom as you like.
Hope this helps,
Andy
"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"
-Stephen Hawking
Bookmarks