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


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  

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.

#2  

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.

#3  

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
Forward()

:Start

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

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

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

  Sleep(500)

Goto(Start)

:Alarm
  Stop()
  Say("Object Detected")
  left(255, )
  Sleep(500)
  Forward()
Return()

:Exit
  Stop()
  Say("Received Command Stop")
Halt()

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

#4  

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.

#5  

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.

#6  

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.

#7  

Well you have given me some great ideas to try so really thanks for the help

#8  

I edited my post above and you may have missed it.

#9  

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.

France
#10  

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 )

#11  

@FredoO

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

P.s your english is fine. Lol.