I am currently using just a ping and not the Blynk server connection check. This is due to two reasons:
I only ping when the robot has received a move command through the Blynk joystick and I stop the ping when the joystick moves back to neutral. That all I really need.
I am using the Blynk functions in Node-Red and while the node shows the blynk connection status I have not spent any time on figuring out how to read the connection status and take action on it.
This ping solution only works on my LAN, but since I only drive the robot when I can see it, this is an acceptable limitation. (ie. the ping solution does not work outside of my LAN).
ok now i know how i will do it .
first i need to now how blynk sends the command . is there a frequency or just new data new sending ?
i will need a command frequency maybe 10 sendings in a second even i make noting .
noting means no change , can be full speed or no speed .
then i have frequency incomming commands from blynk app to the server to my tank ( Arduino Yun )
this will be stepp one .
second stepp
my sketch needs to check if the commands come in frequently (will be fine)(true) ā¦or if no more commands come in and after a delay ( for example 200 ms ) it will shut down pin x or x and y or go to a programed fix point .
so this is my theory
because to reed only the ping from server is not enough your whatever can have a conektion to the server but maybe your phone have lost contakt and the server holds your joystick position . and your whatever drives in to lake.
i go from blynkphone to internet(server from blynk) to a second phone conected in 4g as a wifi hotspot to arduino yun.
so im able to drive wherever i want if i have a 4G mobile network
and im neebe dont now how to make this real ā¦but i think its very Interesting for other too ( hope so )
it means that if Blynk is disconnected the void stopRouting(); will be run. You can put in there all the commands you need to do for stopping the robot.
to reed only the ping from server is not enough your whatever can have a conektion to the server but maybe your phone have lost contact.
so my tank need to now if my phone is conected
You need to create your own heartbeat from the hardware to the app than. Iām not sure how to do this exactly, but it probably can be done with 1 or 2 virtual buttons or ledās.
now the first problem is on the android side to create a hardbeat by blynk app.
it can be just a pulse to a virtual pin on off interwall 200ms if it stops it will kick the FSave in ā¦
As he said, waiting on heartbeats and ping may have your robot loosing control long before it realises connection is broken.
You are not likely to find a magic pill to stop your robots motion via direct Blynk communication, it is not designed for that type of real time safety factor; 10 seconds is a long time for a moving object!
Work on the hardware side and setup a timeout in code (yes, you need to learn some ), wherein if it hasnāt had an incoming command (to move, stop, turn or anything else) in x seconds, then FULL STOP, and then try to re-establish connection.
but if i setup a timeout ā¦and i just drive full speed and keep holding the joystick in position it would stop all x seconds . because no changing valuesā¦