Now, to make sure that you understand the shooting death of that we just created, what we did is basically
the following we created variables and we have sent values or the values of these variables to the city
request.
Now you can't comment this line.
The news, this city, we request that a variable and as you can see without the variables, you can
actually pass the data directly.
So the API key here is this this is our API key and the sensor is the touch sensor that you already
mentioned.
Its location is at home office and the values one, two and three all of these random values.
This can be used for testing purposes.
You can command this and use this line.
They both work the same.
But if you have problems or if you are suspecting something, you can use this one for testing.
Anyway, I will leave it to you if you wish now to send that to TBE Post request.
We need to create an integer and call it a CBP response code equal ish to TBE Dot post.
Now the post will take.
This variable, the one that we created the data, and it will send it through Vashti TV if you need
honesty because with a content type text or plain, you can change the header.
But this is something I want to recommend because what we are doing here is more advanced.
We are sending variables.
Now I will add other ways to arts and let's say, text or plain text or JSON file to the city we request.
But what we are doing here is simply sending sensor readings and variables so you can stick to the content
header that we created, which is basically an application.
And this is its type w WW.
You are all encoded and this is the encoding part.
Now, to make sure that our city request did go and we don't have any error, we initialize an integer
so that the result of this post request can be stored and this variable.
Now to check this variable, we need to ask using an if statement and else.
Now.
Let's do this.
Now that statement will be if the TB response squad is above zero, this means that we have seen data
and we received a value above zero as a response to the post request.
And that case, we need to print and the serial monitor.
Brent HTP response codes.
And we need to print the code to know if that is an issue.
So I ran.
And now the response quote now, otherwise we need to cover these two, if the value isn't above zero,
means that there is an error.
So in that case, we will use the else and we will say error codes.
Code and words print the same code at the end.
We need to end our requests.
So we need to add A.B. and.
This will end that city request process, and we need to close this.
If.
Now.
Else, as you can see, this is our if statement that we did close.
Now if the Wi-Fi is connected, it will do all of this.
Otherwise, it will print that Wi-Fi is not connected so we can write serial dot, print your line and
we can't simply write life.I disconnected.
After that, we need to make sure that we are not receiving data continuously so.
It's this one.
OK.
We need to either delay.
Plus, thirty thousand milliseconds, which is basically 30 seconds.
So this will tell our ISP to send an assertively post request every 30 seconds to send signals or data.
Now, as I already mentioned, I will post the code, but you have to edit the following lines.
The first thing that you need to edit is versus I.D. and password.
And the second thing that you need to edit is the server name, which is this one.
And you also need to edit the API key.
We did initialize the theater communication for debugging purposes, it's not something you have to
do, but it's a good practice so that you can know if your code has errors.
Now, after doing all of this.
You can verify your code.
We will check it if that is errors.
I will solve them now to make sure that we can upload this code.
OK, now they've said it is in capital.
It's.
I did this OK.
Now I think that we might have some spelling errors because I was writing as I was speaking and explaining.
So this might happen.
OK.
Duncan, bowling great.
We don't have any rules.
Now what you need to do is simply copy the squad and based it on your ISP.
And we are going to do this and the next lesson to test out our coding and to make sure that the server
receives the data and everything's working fine.
That's it for this lesson.
If you have any question, please ask in the Q&A about.
Thanks for watching.
This is Ashraf from educational engineering team.