Hello and welcome.
This new lesson.
Now the last part of coding is the low function and that all we need to check the state of the motion
detected variable.
So we'll use an if statement.
F m, detective.
Now, let's make sure that we have the right variable name.
So as detected, if this is true, you cover up equal equal to or you can simply write it without anything.
Now, if it is true, it means that motion is detected or rather defeated.
So we need to send a new message to our Telegram box indicating that motion was detected.
So inside here?
We will use the bot deft send message.
Just like here in the setup function, we will pass the Chuck I.D..
Chad Ivey and we arrived the message motion.
Being affected.
And as an empty thank.
Now, this will send a message now sending a message to the what is very simple.
Send a message will take care of everything.
You only need to pass the arguments.
That is the chart in the message.
The past the past moment is Atlantis.
Now, once we do this, we need to.
Set the motion evicted from true to false to make sure that we can receive any new detection, so false.
This is everything now this methods were written a Boolean value, so we can create a new Boolean variable.
So let's say result.
If one.
And.
If.
Resolve equal equal, or if a result is through, then you can send a serial.
Friend and message.
Message successfully sent.
Else.
We can't face the same cold.
To indicate that her off message wasn't sent.
So it's.
And we can say.
This means that the send message function didn't execute correctly.
Now, if it did execute correctly, we will see this on our window.
We can also send this message.
Along also, this line with the same Sundance motion has been difficult, so this will be sent off in
the go on board.
This will be sent off the monitor now if that isn't.
Of executing the send message function is through.
Then we can easily indicate this by allowing this on the student monitor.
Otherwise, we will print out error that this method was not executed correctly.
That's it.
And the next lesson we are going to try this practically.
So stay tuned now.
We need to compile our code to make sure that we don't have any rules.
Now I can see that you have a spelling error.
This is called our chatting.
Our chat is not out, so this combined again once this is done.
OK.
This is the error.
I have said the name of this variable.
Now, as you can see done, combining the next item is uploading this code to our U.S. B-52 bomber to
test this out.
Thanks for watching this lesson.
If you have any question involving anything inside this code, I'm here to help.
This is Ashraf from educational engineering team.