
Rural Geek
Canada
Asked
— Edited
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
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.
Code:
Looks like you need to specify a value for the GetPing in this script.
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.
I'll try that when I get a chance.
Thanks for the help Dave.
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.
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.
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.