RR333
USA
Asked
— Edited
Hey Everyone!
I know we can have the Robot Avoid Objects,using sonar,,,,,, but can we write a Script that tells the Robot to stand Still then react to something moving towards IT?, Like to move away? Say Like a Pet or Person gets too close to the Robot and it backs away....?
ez script......
ping distance sensor.......
if(adc1, lower, 100) reverse(200) right(300) forward(500)
or something
I tried something similar that might work for you. Use Ping_wait in your script. DJ has an example in the script help. You can have the ping sensor to wait until the specified value that you set is reached. Once the value is reached the script will continue to the next line through the entire script after ping_wait. If the value is not reached, nothing will happen in any of the script that you wrote after ping_wait. If you want, you can click repeat, and it will go back to the beginning, after finishing the script, and wait again until the value is reached. Try a simple script after ping_wait to see if this is what you need.
****I used ping distance to help me decide on the number value (how far or close something is) to use in ping_wait to trigger the script.
yeah good call
wait and if scripts are the best
you will have to use the
go(reverse) :reverse
lines if you want the sensor always on kinda like repeating the process so you dont have to click start on the sensor.
:edge if(adc, a1, > 100) or the wait command,test them out. see what works. stop() servo(d5, 30)
goto(backup) goto(edge)
:backup right(400) forward (500) servo(d10, 50)
goto(edge) goto(backup)
example
THANK YOU!!!!, I will try that!; you guys are Great!