# EV3 basics course. Ultrasonic Sensor. Move after object is removed (part2)

The robot detects an object. After the object is remove we want to make the LEGO robot move forward.

• #143
• 13 Oct 2015
• 2:33

### Detecting

Detecting with the LEGO Mindstorms EV3 Ultrasonic Sensor that there is no object could be as usefull as detecting that there is.

The program is implemented with a number of wait blocks that wait for a specific event to happen. In this case we are waiting for detecting an object and for detecting no object.

### English

The next program that we'll do for the ultrasonic sensor is to have my hand somewhere, initially, very close to the sensor then when I move my hand I'll have the robot to move forward. So we are waiting until we see something at a greater distance. We have very close object, we remove it and it will move forward.

What we have to do is to move the Wait block as a first block in our program. So we just move the wait block as a first block and the second change is that we are waiting but we're not waiting to see something at a distance of 4 inches but to see something that is far away, so it is at a greater distance. Initially we have my hand at a distance of about an inch and then when I remove it there will be nothing in front of the robot and the robot can move forward. So what we want to do is to again compare the distance in inches but we want the distance to be greater than 4 inches. When the distance is greater than 4 inches the robot will move forward and we'll program it move forward for 1 second.

The program is currently running my hand is very close to the robot, I move my hand and when it is at a distance more than 4 inches the robot will move forward.

If I now download because there is nothing in front of the robot will move forward.

If my hand is in front of the robot, download, I remove my hand and it moves forward. In the next videos we'll continue with other tasks for the ultrasonic sensor.

## Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

• 38
• 193:26
• 30
• 5
• 0
• 3
• 3d_rotation 0
• 136
• 280:11
• 156
• 4
• 0
• 0
• 3d_rotation 0
• 136
• 280:11
• 156
• 4
• 0
• 3
• 3d_rotation 0