Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Creating A "button Release" For Mobile Control

Assistance Requested

Help Steve G with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Steve G claims to have checked these sources:
 
#1

I wrote a post a short while back asking DJ if he would consider adding a "When button is released" script input field to the mobile interface, and he very kindly said the he would add it to his "to do" list.

So in the mean time I have been playing around to see if I could I could script something similar, but so far have had no luck. The only thing I could come up with is the following...

Code:


:loop
IF(GetServo(D19) < 120)
ServoUp(D19, 1)
Sleep(25)
ElseIf(ControlCommand("Script Manager", ScriptStop, "Head LEFT"))
EndIf
Goto(loop)



What this does is when a mobile control button is pressed/pressed and released, it will (for example) move a servo, and when the same button is pressed again the servo will stop. Not quite what I want to do. Has anybody got any ideas of how to do this or has a script example you would be willing to share?

I would be happy to wait for an EZ Builder update to include this, but I have had a couple of near accidents where I take my eyes off my phones screen for a second and haven't been able to hit the stop button that I have, in time. Having this option would solve this issue and I could do away with the stop button altogether.

Many thanks. Smile

User-inserted image

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

There is currently no support for cross-platform "button release" events. When a newer update for the mobile device sdk supports it, I will add it.

#3

Thanks DJ. So there's no way to do something similar with scripting that can be added to a mobile control button script in EZ Builder then, as I am currently using a VCN PC remote app?

#4

Sure, a start and stop? do this...

Init the $pressed variable in your Connection or Init script, like so

Code:


$pressed = 0



In the button on your mobile form, have an IF condition that switches the variable back and forth between 0 and 1. Where 0 (zero) is false, and 1 (one) is true.

Code:


IF (!$pressed)

Forward()

$pressed = 1
ELSE

Stop()

$pressed = 0

ENDIF

#5

Brilliant. Exactly what I was looking for. Thanks very much for that DJ. This will help me out loads. Smile Smile