Hello and welcome to this and your last one, and we are going to program E.S.P 32 using Arduino IDE.
You must have the Arduino idea installed and E.S.P, a 32 AdOne installed, as we explained in the download
and install section.
Now, after installing the necessary Bolt Adams Cobie.
The I don't like to argue, no idea, just as explained then you can't simply open Arduino.
To start coding.
Now, the first step that we are going to do is.
Create a new file on your sketch.
Now we need to include some libraries, so let's include the wi fi library.
And we also need to include.
Their city client library.
And we need to include.
Any other labor that we might need for our project, for now, I will just stick with these two.
Now, if you did verify your code, it would ask you to save the code at a certain location.
So here we will save it.
Let's call it E.S.P.
Gold and silver here.
Done combining now what you need to do is create a few variables, we need to create variables for our
wireless network credential, so create a constant character and call it already.
And here you need to enter your network name.
And my network name is called I think I should have TiVo.
Now add a semicolon, add another line.
Constant
character for the password.
And I think my password is this.
Something like that.
Anyway, I'll change it later.
Now let's move on to the server name, create a consistent character.
For the server name and in the server name are going to place are all the domain name and they are all
path, all of the IP address with the path depending on your hosting.
And in our case, we need to copy this.
We need the post data filing, which is basically this one.
OK, let me check this one.
Our domain name and postdated BHP.
So go back here, listed here depending on your domain name.
This might be different, but this is what you need to do.
Now.
The next step is creating the API key value, and we already mentioned that key on the Fabulous on.
And it must be identical to the one you use when you're happy, and to do so, we will have to open
up or be called.
And look for the.
API key value.
OK, here it is, a bickie value.
It is this one Lobach copy and based Diabolik value.
Now you can create any other variable that you want.
You can create a variable for the Zinser name.
Let's call it touch sensor.
And since of location,
let's call it home office since we are at home now.
What you need to do is go to the void setup method and start the serial module at a specific rate and
let's make it a hundred fifty fifteen thousand two hundred.
Now we need to start the Wi-Fi connection wi fi that began using the ID and the password that we used
after that, we need to print the serial monitor line stating that we are connecting so.
Right.
Connecting to the Wi-Fi network.
OK, now, to make sure that we don't have any error, we need to check and to print the local IP address
that we get from our Wi-Fi network.
So let's add this one statement, by the way.
You can copy the Wi-Fi code from the examples if you want here examples and if you want the ISP.
You can't simply.
Look for the Wi-Fi.
And as you can see here, wi fi, if you check the Wi-Fi scan, you can see.
Code for wi fi.
And as you can see why if I disconnect wi fi mode and you can edit the code or use it.
And now it's checking and printing, that's a Saudi you can use this code or you can copy our code.
They both work the same now regarding Wi-Fi, but you have to edit them or edit the code to allow a
Stoebe post and BHP connection.
Anyway, let's proceed.
Now, the Wi-Fi, we need to check that.
The Wi-Fi, the status.
WI fi connected.
To make sure that we are connected and then we cannot to kill the parentheses.
Now, between these two carbon taxes, let's add some delay
to make sure that we are giving all yes people enough time to connect and let's print adopt to indicate
that we did reach this point.
OK, now.
After the wild statement, we can rent an empty string.
Then we can print other lines stating that we are connected to the Wi-Fi with a certain IP address to
make sure that we have an IP address.
OK, now Wi-Fi is connected and use of this IP address.
And now to print the IP address on Wi-Fi network, we can use Siri on that front line and inside it
we need to call Wi-Fi
DOT local IP.
So it will print the IP that our ISP received from the Wi-Fi after.
Now, after doing all of this, we can.
Start the TB process now to start HCB process.
You need to go to the Void Laub and write a simple if statement inside that if we need to make sure
that our Wi-Fi is connected correctly, so we will use Wi-Fi status, equal wireless connected.
Now, if disconnected, what we need right here.
Is first create an Stoebe.
Client object and name it is GTP now, your domain name, who they are on path or IP address must be
passed to the HTP object, be using this line Huckerby begin and inside it you got a server name, which
is basically the server name that we did type here.
Make sure to write it correctly.
We have in capital.
OK, after that, we need to specify content type here to make sure that we are passing the right values
to our Web page, the sense of values and other reading.
Now, right htp dot ad header.
This method is the one that we are going to use to send data.
Now, inside it, you need to write content type, then add a column.
And right, this line fight application slash x, w w w form and you are all.
Encored.
Now, this line can be found online, it's easy and you have to send it before you start writing that.
Now, the next step is to prepare our FTB request data and the data that we will send in that request
is basically the key to Ikki, the sensor location on the sensor name and the value number one value.
Number three, two and three.
And these all of these that are will be sent in a string.
So we have to prepare that strength, create a new string quartet, a city B, request data and start
passing the values.
The first value will be a B, I underscore key and unique to the plus sign and write API key value.
Which is basically the key value that we did assign at the beginning of our.
Codes here.
Now, you need to try the same variables now, plus sign what we are doing now is we are concatenating
a string with the values that we need to send.
So after that, we need to send the census data.
So we were right and center.
Dr..
Equal and you are the plus sign and send dozens of.
The variable we've called since her name.
After that, we will send us your location, you can add on and sign and write that location
equal.
And we will add since that location.
Here they add another blast sign and start adding different values and value, one equal.
And we will add a string, let's call it value one, we can add any other variable here, but since
we haven't assigned any variable, we can simply write value one and you can keep doing this for the
other two.
OK.
Now, the value three for this one value two for this one, so it will send value one value to one value.
Three, we can assign variables for this one, but let's leave them to this at this point.
Now, after we prepare this request.
As you can see, we need to add a semicolon here
and we need to add serial dot print
and.
We are going to print is this ECB request data.
So let's try it again.
So it will be requested that now.
That's it for this lesson in the next lesson, we are going to proceed with the.
With writing our code and making sure that it works for the people and that it will send data to our
website.
Thanks for watching this lesson.
If you have any question about any line of code, I'm here to help you.
See you next.
This is Ashley from Educational Engineering Team.