Continuous action on holding down a button

108 views
Skip to first unread message

Trance Paradox

unread,
Jan 11, 2018, 12:44:55 PM1/11/18
to MIT App Inventor Forum
How to make a button repeat its command on hold down like a switch of a keyboard
I have been trying to make an rc crane through arduino. So any app in play-store doesn't provide that many buttons for my crane. So i began to design an app in MIT app inventor 2. But i am facing a problem, i need to send command continuously to my car. But the buttons i created only give one instruction per tap. Even if a hold the button down it only sends one output, not the continuous output.

Abraham Getzler

unread,
Jan 11, 2018, 12:53:47 PM1/11/18
to MIT App Inventor Forum
For each button, set aside a global variable and two Event Blocks:
TouchDown and TouchUp.

The global variable should be true/false, named after
the button, like LeftPressed = true on TouchDown 
and = false at startup or on TouchUp.

Have a Clock Timer loop thru the Globals and act as
needed by their states.

If you are running parallel long running activities,
you might need to devote lists to action requests
queued by the buttons and serviced by completion events
from whatever they are driving (music, speech, etc.)

ABG

Reply all
Reply to author
Forward
0 new messages