WEBVTT

00:00.180 --> 00:06.570
This is the date of the final project, and in this state, what we want to do is to say that we can

00:06.570 --> 00:08.870
also unlock the application.

00:08.880 --> 00:16.650
So when it is locked, we can also unlock the application when we press on the play button of the infrared

00:16.650 --> 00:17.720
remote control.

00:17.970 --> 00:19.440
So we would have two choices.

00:19.710 --> 00:25.290
Either we unlock with the push button, which is on the breadboard, or with the play button on the

00:25.290 --> 00:26.080
remote control.

00:26.760 --> 00:32.820
So to do this well, I'm going to need to check if the command we receive is the play command.

00:33.030 --> 00:33.960
And actually it is.

00:34.170 --> 00:37.500
So I'm going to create the switch.

00:37.800 --> 00:42.450
So create an empty switch for all the different commands and then handle the play.

00:42.690 --> 00:43.130
Come in.

00:43.500 --> 00:48.230
So cute in the loop.

00:48.450 --> 00:53.220
So instead of removing the line, which is going to command this, because that can be useful later

00:53.610 --> 00:54.990
and then so we have the command.

00:55.660 --> 01:04.260
I'm not going to override the switch directly in the volume here and keeping it simple just to do the

01:04.260 --> 01:05.540
high level conditions.

01:05.550 --> 01:09.480
OK, check the time functionality and call the different functions.

01:09.810 --> 01:12.840
So I'm going to create a new function instead.

01:12.840 --> 01:15.180
I'm going to put it there.

01:16.770 --> 01:25.330
Void handled, I commend and get along, come in as a.

01:28.890 --> 01:37.500
And what I'm going to do is call this function here so Ariki I can do Hendel I recommend refiguring.

01:38.490 --> 01:44.340
And that's it for the volume, so we don't need to do anything else would just get the grunter with

01:44.340 --> 01:47.470
Decode, we get the comen without the comment to another function.

01:47.490 --> 01:50.220
Then in that function, we handle the command.

01:50.760 --> 01:57.360
So I'm going to switch with the command and I'm going to take each case.

01:58.140 --> 02:00.990
So I'm going to go back to the beginning.

02:01.020 --> 02:06.300
Let's let's just copy and paste that here for.

02:08.840 --> 02:12.830
Just like this, we have the defense and then I'm going to remove it, so Jake.

02:13.870 --> 02:14.920
First case.

02:17.780 --> 02:23.540
And then do so here, which we're going to do is take a look and then break.

02:25.530 --> 02:28.800
And then case with the signature of.

02:30.270 --> 02:38.880
It I'm simply going to put to do here, so we are going to fill those twos in the following steps.

02:40.160 --> 02:42.860
Kees, EQR.

02:45.440 --> 02:48.020
And then to the break.

02:49.100 --> 02:49.700
Jas.

02:52.290 --> 03:01.140
So that can be a little bit repetitive here, but once it's done, it's done, she's done.

03:02.280 --> 03:03.060
But don't.

03:04.710 --> 03:05.190
To do.

03:06.640 --> 03:11.300
Right, and if you make sure that you correctly create the switch structure at the beginning, then

03:11.300 --> 03:12.910
you would not have any problem here.

03:13.160 --> 03:13.800
It's clean.

03:14.150 --> 03:17.870
Now, I can add any functionality without breaking the switch.

03:18.260 --> 03:19.550
And, of course, default,

03:22.760 --> 03:27.150
I think a default, even if inside we do nothing.

03:27.410 --> 03:33.980
So the default, basically, if we receive documents that if we press on a button that is not defined

03:33.980 --> 03:34.260
here.

03:34.490 --> 03:35.930
Well, what do we want to do?

03:36.260 --> 03:38.270
Well, in this application, we want to do nothing.

03:38.270 --> 03:39.860
So I do nothing.

03:39.860 --> 03:47.030
But I started writing the default book because this is a super best practice and.

03:48.000 --> 03:53.050
Let's remove that, of course, and now we have our switch.

03:53.490 --> 04:00.630
So what I can do is complete this current step by unlocking the application when I press on the play

04:00.630 --> 04:01.020
button.

04:01.710 --> 04:08.340
And to do that when it's super, super simple, because we already have all the lock and unlock mechanism

04:08.340 --> 04:10.980
working with functions that we can call directly.

04:11.010 --> 04:15.510
So what I can do is code unlock function and that's it.

04:16.320 --> 04:18.070
So where is the function?

04:18.090 --> 04:26.030
It's here in that function which check if it's locked, if yes, we unlock the application and we pull

04:26.040 --> 04:26.490
out of the.

04:29.710 --> 04:37.780
So basically so this comment actually can be he's not in the is not OK, if it's not, this can be called

04:37.780 --> 04:38.360
anytime.

04:38.530 --> 04:39.490
So basically.

04:41.730 --> 04:48.810
This, whenever you press the button, play it, we call the analog function, whether it's locked are

04:48.810 --> 04:54.960
not locked, but then because you have this check, if it's locked, then it's not a problem.

04:54.960 --> 05:01.080
If you just press on the play button and it's not locked, it's just going to do nothing.

05:01.500 --> 05:03.710
OK, so now everything is ready.

05:03.750 --> 05:04.580
I can just.

05:04.590 --> 05:11.640
So that's the verified code with final project step number eight already.

05:14.460 --> 05:18.600
And Kate's done compiling lists of blue code.

05:20.090 --> 05:27.550
So we have initializing and then the application with no physical outputs or obstacle here wanting,

05:27.890 --> 05:34.240
and then I go to closed obstacle price to unlock, what I'm going to do is press on the play button,

05:34.280 --> 05:34.630
OK?

05:35.210 --> 05:38.890
And you can see now the application is unlocked.

05:39.200 --> 05:46.160
So if I press on the play button, OK, you can see here the right energy is on means that we receive

05:46.160 --> 05:51.110
some data, but nothing happens simply because, well, it's not locked at the moment.

05:51.550 --> 05:57.050
So now, again, I put an obstacle that is going color press to unlock.

05:57.050 --> 05:59.990
I can unlock again with this play button.

06:00.330 --> 06:01.350
I can also.

06:01.430 --> 06:03.410
So that's the application again.

06:03.890 --> 06:06.430
I can press the button here.

06:06.470 --> 06:07.790
That's the same behavior.

06:08.910 --> 06:10.790
All right, and that's the end of the steps.

06:10.860 --> 06:19.080
Now you have two ways to unlock the robot on the application directly on the breadboard with the remote

06:19.080 --> 06:19.560
control.
