Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited

Syntax Error In Ez Script. I Am Missing Something

Hey guys. I am just starting to write a script for my bot and I am trying to get data from a Parallax ping sensor and decide what to do with the data.

I think I have typed the script right but I am getting an error. Can you guys take a look and let me know where I messed up.

Thank you
User-inserted image


Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

Did you want to state the same port twice? Here is what you have: (D8,D8). Then in the next statement you have (d8,D8). I don't knew how the Ping thing works as I haven't worked with my Sonar yet but listing the same port seems odd to me.
I just copied your script and tried it and got the same issue. I then got rid of one of those D8's and it ran without error.

Again, I don't know if you have your sonar attached to two ports that need monitoring. Let me know what you find as I'll be using this in my build sometime soon.
Here's a navigation example written by DJ that looks like the same thing your doing.


# This variable will be used to determine if we exit.
# If it is a 0, we continue running
# If it is a 1, we exit this script
$exit = 0

# begin moving forward


# Get the ping sensor value
$ping1 = GetPing(d9, d8)

# If the ping sensor value is less
# than 20, alarm!
if ($ping1 < 20)

# If the exit value is 1, exit the script
if ($exit = 1)



Say("Object Detected")
left(255, )

Say("Received Command Stop")

Looks like you need to specify a value for the GetPing in this script.
Hi Dave.

I was just going by the example in the script helper for the GetPing. It says you need the trigger port and echo port. Since I am using a Parallax ping it only has 3 pins versus the one that comes with the kit it has 4.

The reason I like the Parallax ping is it saves on D ports.
Oh I see what you talking about I use the getping to get the data and put it in a variable then use the variable in the logic.

I'll try that when I get a chance.

Thanks for the help Dave.
I don't understand why the statement works on DJ's example and not yours. Perhaps you need to write the script using variables like DJ has done.

I wrote my first movement script trying to use numbers just like you did instead of a started variable and is would not work. Once I redid it all worked nicely. See my "Move Waist" script in B9 Robot Control in the EZ-Cloud.
Well you have given me some great ideas to try so really thanks for the help
I edited my post above and you may have missed it.
Well thanks for trying it out. I just change it to a variable and the error is gone. So I'll try and run it tomorrow when I get home from work.

Then i am going to add more code. I am excited to learn more coding I like to code. That is why I like my job as an electrician and working with Fanuc robots and plc's in a manufacturing plant.
Hello !

If you use parallax ping with 3 wires ,you can simply use "getADC" instead of "getping" , because your sensor have just an analog output .
Getping is for sensor that need a trigger.

(sorry ,bad "frenchglish" *eyeroll* )

I never thought of using an ACD. Thanks for the idea I'll try it.

P.s your english is fine. Lol.