Stop on detecting an object with the Ultrasonic sensor and move after detecting there is no object. Join of the previous two video tutorials in one
- 14 Oct 2015
Previous video tutorials:
Program developed with EV3-G for stop and Move with the Ultrasonic Sensor
The next program is the following. We move with the robot forward until it reaches my hand at a distance of about 4 inches or 10 cm and then it waits until I remove my hand and it will continue forward. Let's see how we can implement this program.
What we want to do is to move forward with motors A and D for undefined amount of time, so we don't know where the object will be, but we are waiting for the ultrasonic to detect something at a distance less than 4 inches and then we stop with the motors.
The next thing is that now we are stopped and we are again waiting until the object is removed. We are waiting for the ultrasonic sensor to detect distance greater than 4 inches.
As we detect distance greater than 4 inches we move the robot forward again with the Tank block.
So this will be our program. Let's download it to the robot and see how it works. I place my hand here.
Let's do this again because I moved my hand.
The robot moved forward until it reached distance of about 10 cm to my hand and now when I remove my hand the robot will again move forward for about a rotation.
Now let's see how we can program the ultrasonic sensor to follow my hand.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons