Asked — Edited
Resolved Resolved by Dunning-Kruger!

Looking For A Way To Ping_Wait Command Timeout

Good Afternoon,

I know there is a ping wait command. I want the ping wait command to time out in 5 seconds.Thoughts on this are most welcomed.


Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!


Set up a RepeatUntil loop instead... It will poll the ping (as fast as you set the sleep for) for the amount of time (or number of checks set in a variable) that you specify and then exit the loop....

United Kingdom

use a GetPing If nest to check the ping for the required value wrapped inside another IF nest which cycles for 5 seconds or a repeat until command.

# Get the current seconds and store it
$oldsecond = $second

# A quick check to avoid errors if the second is about to loop back to 0
IF($oldsecond > 55)
  # subtract 60 from it to make a negative number
  $oldsecond = $oldsecond-60

# Start the repeat until 5 seconds time
RepeatUntil($second = $oldsecond + 5)

# Check the ping and exit if ping is met
IF(GetPing(D0,D1) = 200)
  # Escape the loop

# Reduce processor load

# End of repeat


Note: Script not tested nor written in ARC. Check the commands and use as a base for your script.

It's not idea and wont give exactly 5 seconds (it'll be at least 4 seconds but less than 5)


Something like this... (I just hacked this so I haven't checked the syntax)

This will loop for approx. 60 seconds




if($ping)<20 # or whatever value you want

# then do something






Do you need to have the Ping to restart once you stop it? If not how about a Sleep(5000) Command then a StopScript Command or Halt()? if you want to have it restart how about using a StartScript?

Ping_Wait(D3, D4, HIGHER, 50)

Or you could use two scripts; one starts the Ping, starts the second script and then pauses after 5 seconds. There would be a 5 second sleep in the second script then a Resume command. Like this:

"HoldPing script"

 Ping_Wait(D3, D4, HIGHER, 50)
Example: ControlCommand( "Script Manager", ScriptStart, "PingStart" )

"PingStart script"

ControlCommand("HoldPing", Resume)

You may have to adjust the sleep time to your liking.

EDIT: @Rich 7 @Richard, you guys slay me. Why do I even try? :D


Ha, ha... And the funny thing is I learned most of this stuff from Rich....:P Dave, you have a good idea... Stopping and starting a WaitforPing script via another timed script is not a bad idea...



Thanks Guys! On a different note, Could you please explain to me the ControlCommand() script start. I would like to run several scripts upon the connection of the EZB V4.

United Kingdom

The easy way is to click on the Cheat Sheet tab in the EZ-Script dialogue. This brings up all ControlCommands available in your project. clicking on one will add it to the script for you.

User-inserted image Image courtesy of DJ in a different topic

ScriptStart basically starts the script specified. ScriptStartWait does the same but the main script which calls it will hold at that line until the script started with ControlCommand has finished.


Thank You all for your quick help and feed back!