WEBVTT

00:00.240 --> 00:04.240
In this new activity, you are going to start from the code we have here.

00:04.260 --> 00:11.910
So to read the ultrasonic sensor and also using the interrupt and you are going to add a new functionality

00:12.330 --> 00:15.550
with the three entities that we have on the secret.

00:15.990 --> 00:24.660
So basically, when you read the distance here, you are going to go on and depending on the distance

00:25.260 --> 00:32.520
so you can, for example, alert the user if an obstacle is too close from the sensor and maybe too

00:32.520 --> 00:34.610
close from the robot of the original.

00:35.340 --> 00:39.060
So what you are going to do is you are going to check the distance.

00:39.060 --> 00:50.320
And if the distance is greater than, let's say, one meter is a 100 centimeter, then you will power

00:50.370 --> 00:55.770
the LDP or the green and all the energy on them.

00:55.800 --> 00:56.320
Attention.

00:56.370 --> 00:57.460
You don't have a green energy.

00:57.960 --> 01:08.350
OK, now if the distance is between 15 and 100 centimeter, you will power on the yellow alley.

01:08.390 --> 01:08.750
OK.

01:09.190 --> 01:10.390
The PIN number.

01:10.920 --> 01:12.380
OK, as a warning.

01:12.390 --> 01:17.600
OK, if there is nothing closer than one meter, that is fine.

01:17.640 --> 01:18.920
OK, there is no danger.

01:19.230 --> 01:27.950
If there is something between 15 centimeters and one meter, then with the yellow LCD we get a warning

01:27.960 --> 01:33.780
and then if the distance is lower than 15 centimeter in that case.

01:34.800 --> 01:43.140
Red energy, all the energy that isn't been put, so in that case, we have the real obstacle that is

01:43.140 --> 01:47.470
just in front of the robot and then we need to take some action.

01:47.610 --> 01:52.720
So here we are just going to show an indication, OK, depending on the distance.

01:53.670 --> 01:56.710
And this activity is actually not that complicated.

01:57.210 --> 02:02.670
What I recommend you to do is not actually because we are going to start I'm going to start from this

02:02.670 --> 02:04.830
program in the activity solution.

02:05.190 --> 02:11.640
But what you can do is start from scratch and redo the entire program by yourself, try to do the entire

02:11.640 --> 02:18.240
program to get the ultrasonic distance using the Internet and then add this functionality.

02:18.390 --> 02:20.940
And I will see you in the next listen for the solution.
