ARC Pro

Upgrade to ARC Pro

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

PRO
Synthiam
#49  

Is the RepeatUntil() what Richard uses to exit a script?

You can exit a script with HALT()

#50  

@Rich For obvious reasons I use an impossible statement to have the repeatuntil loop repeat forever... When I first stated using ez robot about a year and a half ago, I did use goto loops instead of repeatuntil... However, it might be just with the ezb3 (because this is what I was using) after a minute or two in a goto loop the ping would fail to fire. With a sleep set at 100 between checks, the ping would just stop working for some reason... I replaced my "read ping goto loops" with a repeatuntil loops and it immediately fixed the ping/firing problem...

To be honest I feel the repeatuntil statement is just a better way to do infinite loops. Goto statements are more meant to jump from place to place in your code...

#51  

@nomad.... Try this and let me know if it does what you want... I had to fix my if statement... forgot the brackets...


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

@nomad... Try this one too... see what works better...


setVolume(100)
repeatuntil(0)
$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
#53  

rr goodmorning

danger danger danger is track-4 actully sonar is track-5

it did nothing just lot off heavy noise this is what i want to have.

first ping goes left and right whithout detect any and play sound file (sonar)

then when he spot something stand still and play danger danger danger. when the object leaves he goes back to left and right whit sonar sound.

#54  

@nomad... Play with this one to see if you can get it to work the way you want...


setVolume(100)
repeatuntil(0)
$distance=GetPing(D20,D21) #check ping
if ($distance<50)
servo(D3,90)
ControlCommand("Soundboard v4", Stop)
ControlCommand(Soundboard V4, Track_4)
sleep(3000) # change to what works best
ControlCommand("Soundboard v4", Stop)
else
ControlCommand(Soundboard V4, Track_5)
#may need a sleep command here
endif
servo(D3,50)
sleep(250)
servo(D3,130)
sleep(250)
endrepeatuntil
PRO
Belgium
#55  

rr the previous one stops rotating and disconnects the ezbv4

#56  

Which script? What post #?

How long are those sound files 4 and 5 when you play them on their own? 1,2 or more seconds long?

Take out the ControlCommand("Soundboard v4", Stop commands and see if it still disconnects... Make sure you battery is good as well... a weak battery would cause your ezb to disconnect while moving or attempting to move servos...