This is the date of the final project, and in this state, what we want to do is to say that we can
also unlock the application.
So when it is locked, we can also unlock the application when we press on the play button of the infrared
remote control.
So we would have two choices.
Either we unlock with the push button, which is on the breadboard, or with the play button on the
remote control.
So to do this well, I'm going to need to check if the command we receive is the play command.
And actually it is.
So I'm going to create the switch.
So create an empty switch for all the different commands and then handle the play.
Come in.
So cute in the loop.
So instead of removing the line, which is going to command this, because that can be useful later
and then so we have the command.
I'm not going to override the switch directly in the volume here and keeping it simple just to do the
high level conditions.
OK, check the time functionality and call the different functions.
So I'm going to create a new function instead.
I'm going to put it there.
Void handled, I commend and get along, come in as a.
And what I'm going to do is call this function here so Ariki I can do Hendel I recommend refiguring.
And that's it for the volume, so we don't need to do anything else would just get the grunter with
Decode, we get the comen without the comment to another function.
Then in that function, we handle the command.
So I'm going to switch with the command and I'm going to take each case.
So I'm going to go back to the beginning.
Let's let's just copy and paste that here for.
Just like this, we have the defense and then I'm going to remove it, so Jake.
First case.
And then do so here, which we're going to do is take a look and then break.
And then case with the signature of.
It I'm simply going to put to do here, so we are going to fill those twos in the following steps.
Kees, EQR.
And then to the break.
Jas.
So that can be a little bit repetitive here, but once it's done, it's done, she's done.
But don't.
To do.
Right, and if you make sure that you correctly create the switch structure at the beginning, then
you would not have any problem here.
It's clean.
Now, I can add any functionality without breaking the switch.
And, of course, default,
I think a default, even if inside we do nothing.
So the default, basically, if we receive documents that if we press on a button that is not defined
here.
Well, what do we want to do?
Well, in this application, we want to do nothing.
So I do nothing.
But I started writing the default book because this is a super best practice and.
Let's remove that, of course, and now we have our switch.
So what I can do is complete this current step by unlocking the application when I press on the play
button.
And to do that when it's super, super simple, because we already have all the lock and unlock mechanism
working with functions that we can call directly.
So what I can do is code unlock function and that's it.
So where is the function?
It's here in that function which check if it's locked, if yes, we unlock the application and we pull
out of the.
So basically so this comment actually can be he's not in the is not OK, if it's not, this can be called
anytime.
So basically.
This, whenever you press the button, play it, we call the analog function, whether it's locked are
not locked, but then because you have this check, if it's locked, then it's not a problem.
If you just press on the play button and it's not locked, it's just going to do nothing.
OK, so now everything is ready.
I can just.
So that's the verified code with final project step number eight already.
And Kate's done compiling lists of blue code.
So we have initializing and then the application with no physical outputs or obstacle here wanting,
and then I go to closed obstacle price to unlock, what I'm going to do is press on the play button,
OK?
And you can see now the application is unlocked.
So if I press on the play button, OK, you can see here the right energy is on means that we receive
some data, but nothing happens simply because, well, it's not locked at the moment.
So now, again, I put an obstacle that is going color press to unlock.
I can unlock again with this play button.
I can also.
So that's the application again.
I can press the button here.
That's the same behavior.
All right, and that's the end of the steps.
Now you have two ways to unlock the robot on the application directly on the breadboard with the remote
control.