:sign0144:
Hello every body, Now I need your help please. I want to control my toy car by my own phone, Now I can control it but my problem is while I touch on the button, phone send data only one time. I want to know how to make it send every time while I hold button until I release button to up.:sign0085: View attachment Code.txt
Think of your code more in a timer that
is enabled and checking
dim moveforward as timer
moveforward.enabled=true ' set it up for ever 100ms
MOVE_FORWARD_FLAG=FALSE
sub moveforward_tick
If MOVE_FORWARD_FLAG=TRUE then
If connected Then
TextWriter1.Write("0")
TextWriter1.Flush
End If
end if
end sub
B4X:
Sub btnEvent_Click
Dim send As Button
send = Sender
Select send.Tag
Case "BUTTON_DOWN" 'person pressed button
MOVE_FORWARD_FLAG=TRUE
Case "BUTTON_UP" ' person released button
MOVE_FORWARD_FLAG=FALSE
End Select
End Sub