Went on to become this new lesson in what you're going to call the sit up function.
Now first, make sure that the board is selected the way it is be set to get better in one by going
to the SB 32 Arduino and selecting the Do It SPF 30 tool kit.
The gentleman next step you need to ensure that you'll verify the first part of the code that we just
roll to make sure that you have all the right and installed correctly.
Now, once you see they're done compiling, it means that the code is written correctly and we can move
on, as you can see today.
Ambassador function the first thing is enabling the serial monitor.
The highest body, like a hundred fifteen thousand four hundred.
Now we need to make sure that the pin that the motion detectors connected to is configured as in football.
Because we need to receive the value from this bin and we need to enable the pull to stored internally
for that bin.
So pinhole.
Here you need to.
Right now, I'm.
Now, the pin number here is.
Twenty one, so will use censorious to the fighting.
No.
And here, when you try to import.
All of.
That's it.
Now the next step is enabling the interact.
Now we need to receive the sense of signal as interrupt signal that will interrupt any thing that's
happening inside our code and send the message to our Telegram port in order to do this and argue.
It's a very simple thing to do.
So just like Dash?
Interact.
As you can see now, if you have an alternate means that works and you have written it correctly.
Now we need to buy that digital pen to enable the interruption.
So I didn't dump.
Ben, do.
Dropped and the motion sensor pin.
The second value that we need right here.
Is the interrupt functioning?
So you need to buy, let's see, movement.
Depiction.
And you need to create a function with this name, and we will create it in a minute.
The third thing that you need to write is the rising or falling age, whether you want the internet
to happen on the rising or on the following.
Now the easiest way to understand rising and falling edges.
Is by looking to the following schematic.
Now let's say that this is about us.
This is off on, then off again.
Now we call this.
Moving from zero to one facing edge.
So this is the leading edge of eyeballs now moving from one to zero.
We call it the falling edge because as you can see, the bus is falling down from one to zero.
So this one is called rising.
This one is called falling.
Well, sometimes it matters, you can do something when you are underwriting a judgment and another
thing when you are and the following it's not in our case, it doesn't matter.
So we were right, rising or falling.
Well, now we will go with rising interest would be enabled on this ben.
And once the anthrax happens on the rising edge, it will call this function.
Now we haven't yet written dysfunction.
So we need to write it now.
Now, Kobe, the function name.
Go up here before the vote set up.
On this grave dysfunction, I void.
And right.
The function name.
And inside it, we need to find a function called the code would include only one line if motion is
detected.
This function will be called, so we need to sit down and detected two faults.
It's not a control.
Now you need to right here.
I farm.
And those four attributes, this is something you have tried before in the function name in order to
enable this function.
Now, when motion is detected, we needed to write and detected through now in order to make sure that
everything works fine.
We can't send on the front line to prevent that motion is detected motion as being the.
OK, so we'll send this for debugging, and we will sit time detective to explore.
So again, when the first thing that we did here is enabling the 7th of October debugging.
The second thing is setting the absence of a pin for the motion detectors and sort of as input.
Then we enable the interrupt on this pin.
And one tenth of what happens on the rising edge, as we already explained, it will call the movement
detection function the moment the action function will execute these two lines of code.
It was said that detected valuable to through and it will print this on the serial monitor.
Now.
We are done with the motion detection force.
Let's do the wi fi part, so let's both see real offense.
Why fi?
Or trying to connect the Wi-Fi.
Now we need to ride the Wi-Fi network CCTV off of this line.
So Syria with friend and.
This idea that a society is the variable that we created here.
In this line.
And whatever we like here, it will be written when we call the brand new line function.
Now we added print and print new line here because we want to print this sentence on one line and proceed
with printing this on the same line.
After that, we want to go to a new line and that's why we added and here.
So print will print on the same line print and we'll print on the same line, but it will add a new
line after finished printing.
Now, to connect to our iPhone, we need to arrive the following sentences.
Now you can't see this, though the iPhone library not ready for you to yours.
So right, Wi-Fi?
Steve, this is a microphone for the Wi-Fi function now like the iPhone that began.
It will take two variables a society.
The passport.
Once you have done with this, the only thing that we need to do now is.
Add something called road certification for API Telegram bots, so to do that, you need to write the
following when you need to call the client.
And I'd sit.
A certificate.
This is a function inside the client and pass the telegram.
Certificate.
Tea.
It gets underscored.
Do that function.
So SIT Certificate will call telegrams and certificates.
Now the next step is to make sure that we are actually connected to Wi-Fi and this is done using our
statements.
This little statement will take.
The Wi-Fi.
The status.
Function that returns the Wi-Fi connection status if it does not equal wireless connected.
It will print dots.
So Syrian.
So, friends.
Dots will keep planting dots until we are connected to the Wi-Fi network, and we will either delay.
Of 500 or the sea, 300 milliseconds.
Now, once we are done, we are connected and we put out Syrian.
The brand new line.
And a new line then of the sentence by five convicted.
Why fine?
And, Nic, good.
Then the IP address.
Make sure that you are actually connected.
I address.
And the last step is.
Writing the IP address itself by find.
The local.
IP.
This function will tell the IP address for our Wi-Fi, although our ISP 32.
That's it.
Now the last step is sending a message.
So about.
Dot.
Send message, this message will include the following that chart idea, which is basically the variable
that we gathered here, our chart idea.
And.
It will send books.
Stops of.
Motion.
Motion Picture Motion Picture.
What started up and we will send them this thing, which is the third end, but now we need to make
sure to pass our chat I.D. to make sure that our ISP will only receive messages from us, not from anyone
else.
Once we have done with that, only one step remains, which is programming that all statements.
Now, before moving forward, let's explain what we have done so far and in the next lesson from program
that statement.
Now first, we enable the serial monitor you are signed up in and pull up.
To enable double our brothers sisters, and I'm sensitive to the pin number for the motion detector,
we enable interrupt on this pin.
And once that interrupt takes place, once we receive a signal on the rising edge from the motion picture,
we will call the interrupt function, or ESR.
This interrupt function.
Well, planned on the settlement, a motion has been detected and it will die.
Now undetected, well, equal rule, and we already mentioned that this is the variable that we are
using to enable or disable also.
The detection now we go back here and planned on the sheer amount of trying to connect to, I find we
print this idea for our Wi-Fi network and we said the final toast to.
Then we begin the life.I connection using devices I.D. and the password.
Once done, we send the Telegram birth certificate using client that said certificate and by writing
this macro.
We don't know or we don't have to know what's written inside this.
It's already written in the Telegram bot library.
Now next, we need to make sure that we are actually connected to qualify.
So we'll check wi fi status.
If it is not connected, we will keep printing dots.
If it is connected, then we will get out of this wide loop.
Once done, we will go here and we will plant a new into line.
We will identify connected and we will.
And let's separate the IP address.
As you can see, why find local IP on the last tip is sending a welcome message to indicate to our Telegram
chat bot that the device or our ISP towards ON so it will try Motrin and Temperatura both started up
using the send message feature.
Now, in the next step, we will program that all function and start the testing process.
Thanks for sharing this lesson.
This is Ashraf from educational engineering team.