And it's time for a new activity so you can practice with the new Pir sensor you have added to your
circuit.
And this activity will, if you manage to successfully do the previous ones, this activity is going
to be quite easy.
So what do we want to do?
We want to do an automatic lighting control.
Or it could be an alarm system.
Well basically we want to turn on the LED if there is movement.
So the LED whichever LED for example the first one we're going to turn on that LED if a movement is
detected and turned off if no movement is detected okay.
So it should be quite easy.
You will need to import the different modules, initialize the components, and then find a way to do
that.
And that's the first part.
As the second part we're going to do an improvement with the code because I'm going to give you a new
function okay.
To use as a challenge to try to use this new function.
So what you have seen for now is that let's say we have initialized a Pir variable here.
You can do Pir dot motion detected.
Okay.
This is going to give you true or false.
But then there is something else that you can do.
So in the code if you remember with the button we had something like button dot when pressed.
Okay.
And you would register a callback function.
Well you have the same thing for the pi you can do pi r dot when motion like this.
And pi r dot when no motion.
Okay.
So quite explicit.
If a motion is detected then you can register a callback function.
If you are not sure about callback function, please go back to the section where we plug the plus button.
And then we do the activities.
I explained all that in those activities.
So basically when motion is detected you can give a function.
So my for example you have defined a function my function.
And make sure to not put any parentheses okay.
And you can do the same with no motion.
So when you do this you will also need to pause the execution after because it's just going to register
a function to call later when this is happening.
So I don't give you any more information right now.
It's your time to practice and I will see you in the next video for the solution.