isPressed? wasPressed? What's the difference?
dclaar last edited by
My impression was that
isPressedreads the immediate state of the button, but
wasPressedindicates that the button was pressed at some point. But trying it out, that doesn't seem to be the case:
for count in range(10000): wait_ms(1) label0.setText(str(btnA.wasPressed()))
False, as does putting
isPressed()in there, no matter how many times I press the button.
So, what is the difference?
ajb2k3 last edited by
Ispressed is used to preform an action when a button is pressed.
Waspressed is used when you want an action dependent on how long the button was held down for.
Ispressed is a command block and requires other blocks and commands for use whereas,
Waspressed is a loop function that is used to control other blocks/commands.