ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

United Kingdom
#33  

@nomad.

Good to see it working. I won't give you the script to do what you asked, but I'll give you some clues to what you need so you can Give it a try.

If the ping sensor reads over 50, play sonar sound and rotate the servo.

or else if ping sensor reads below 50, stop sonar sound effect and say "danger".

Put in a sleep command.

Go to the start of the script and do the process again.

The clues of what script commands you need are written above. Give it a try and report back.

Good luck.

PRO
Belgium
#34  

steve g thats a huge task for me ,give me a couple off months haha just kidding. i like the way you teach.ok let see wht i can find. eek

United Kingdom
#35  

@nomad.

No problem. Truth be told, I'm not 100% sure how to write the script as im still learning too, but I understand the principles and what's needed...

If over 50, scan and play sonar sound

Elseif under 50, stop scan and sonar sound and say "Danger".

If I had my laptop with me I could probably write the script okay, but I'm away for the weekend so can't give you more than that for now.

#36  

setVolume(100)
repeatuntil(1=2)
$distance=GetPing(D20,D21) #check ping
if ($distance<50)
servo(D3,90)
sayEZBwait("danger, danger, danger")
else
ControlCommand(Soundboard V4, Track_4)
#may need a sleep command here
endif
sleep(250)
endrepeatuntil
PRO
Belgium
#37  

rr

steve g gonna like this code

#38  

Maybe a better script..


setVolume(100)
:top
ControlCommand(Soundboard V4, Track_4)
repeatuntil(1=2)
$distance=GetPing(D20,D21) #check ping
if ($distance<50)
ControlCommand("Soundboard v4", Stop)
servo(D3,90)
sayEZBwait("danger, danger, danger")
goto(top)
endif
sleep(250)
endrepeatuntil
United Kingdom
#39  

@Richard.

That's a new one for me. I haven't come across that before.

PRO
Synthiam
#40  

Steve, :Top is a label for the Goto command

Goto will "jump" to the label

A script starts from the top and reads each line downward

When the line reads GOTO(label), then the script will jump to the label. In this case, the label is called TOP. You can name the label anything you want.

You can name the label CHICKEN, if you like chickens. Or you can name it something that identifies what it is for, in which case CHICKEN wouldn't make sense.

Richard used TOP because it's the top of the script. He could have named it anything, but it's nice to name it something that us humans can understand when reading the code back.

For more information, load the GOTO RETURN STACK.EZB project located in Examples\EZ-Script Function Syntax folder