Arwin
Joined: 12 Jul 2005 Posts: 426
|
Posted: Wed Aug 24, 2005 4:44 pm Post subject: Re: Button help |
|
|
| jivemasta wrote: | | Ok, I have the code to see when you press a button. But I only want it to go through the code for the button press once while its held down. now it does it every time it goes through the main loop. Is there a way to tell when its lifted so it will only work when they lift the button? |
You could set a variable when it is pressed, and then keep your loop going while that variable is true, until the
crossdetected = true
ispressed = true
while ispressed
pad.read()
if pad:cross()
crossdetected = true
else
if crossdetected
crossdetected is false
endif
endif
wend
But I think there was another way, something like pad:_cross(), the underscore indicating that there was a release. You should look at the example Shine gave in my thread on button presses, as that one distinguishes between presses and releases. |
|