Asked — Edited
Resolved Resolved by Dunning-Kruger!

Re-Connect

What is the quickest way to set up the EZb to re-connect automatically if connection is lost when it is the host going right to my laptop?


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

#1  

Have a script running in the background (in a loop) checking the connection status with the command IsConnected()... if IsConnected() comes back false then use the ControlCommand Connect() to reconnect...

Check a script for these commands


repeatuntil(1=2)
if(IsConnected=0)
ControlCommand("Connection", Connect0)
sleep(3000) #give a little time to reconnect
endif
sleep(1000) # check interval
endrepeatuntil

#2  

$connected = IsConnected( 0 )
REPEATUNTIL($connected = 1)
  If($connected = 0)
    $Connection=0
  Else
    $Connection = 1
  EndIf
 if($connection = 0)
   ControlCommand("Connection", Connect0)
   $connected = IsConnected( 0 )
   sleep(4000)
 endif
EndRepeatUntil 

This is a bit sloppy but I threw it together just now. Between Rich and this, you should be able to see what is happening. I would put in a monitor script that monitors connection status and other things like maybe temp or whatever else you decide is necessary. Then call this script (or richards) from the monitor script that can loop multiple times.

United Kingdom
#4  

Even simpler...


:loop
IF(IsConnected(0) = 0)
  RepeatUntil(IsConnected(0) = 1)
    ControlCommand("Connection", Connect0)
    Sleep(1000)
  EndRepeatUntil
EndIf
Sleep(10000)
Goto(loop)

That should loop forever, check every ten seconds if it's connected, if it isn't it will attempt to connect every second until connected. It should connect within a second if able to, you can reduce the ten second checks to 5 seconds or even every second if you wish. The more frequent the checks the more processing power it'll take though.