(lego mindstorm robot) Distance sensor

Materials

1- Tablet with mindstorm app

2- Mindstorm robot

3- Distance sensor

Step  1 : Connecting and programming

connect the distance sensor ( ultrasound sensor) with the port 4

Infrared Sensor ___ Compare ____proximity 

Step  2 : challenges

-Place an object in front of the sensor and move it,  and when it reaches a distance smaller than 20 cm,  STOP word appears on the screen.

-Place an object directly in front of the sensor and move it. When it reaches more than 40 cm, it says the word stop.

Note: don't forget to put time delay