0:08
hello everyone welcome to controllers
0:12
tech I have already made videos about
0:15
multiple you arts using ring buffer
0:18
I have also covered the basic setup of
0:21
esp8266 Wi-Fi module today in this
0:27
tutorial we are going to create a web
0:29
server using esp8266 Wi-Fi I will show
0:34
you how to use this web server to
0:37
control the LED on the microcontroller
0:39
let's create our project with cube IDE
0:43
first I am using f4 for 6r II give some
0:52
name to this project and click finish
1:05
in the cube MX first of all I am
1:08
selecting the external crystal for the
1:17
next select UART one which will be
1:21
connected to the ESP my esp8266 is also
1:27
at eleven five 200 baud rate turn on the
1:36
UART to is connected to the computer
1:40
leave it also at the same baud rate and
1:43
turn on the interrupts pa5 is connected
1:56
let's go to the clock setup now I have 8
2:01
megahertz crystal I am running system at
2:04
50 megahertz this is just because many
2:08
of you asked me why I always set the
2:11
maximum clock this time I am selecting a
2:15
smaller clock click Save to generate the
2:31
this is our main C file first of all we
2:37
need to copy the library files copy the
2:46
header files in the include folder and C
2:48
files in the source folder you can get
2:52
these files after you download the zip
3:06
now include the esp8266 hull h in the
3:18
let's take a look at it here you get
3:22
these two functions ESP in it
3:25
initializes the Wi-Fi servers start do
3:29
the rest of the job let's just refresh
3:36
this so that all the files will be added
3:39
you are drink off a multi dot C I have
3:42
already told you about this in my
3:45
previous videos change the you arts
3:48
according to your setup here also modify
4:00
we need to copy this and put this in the
4:20
we also need to change the default
4:22
interrupt handlers for the UART one and
4:36
let's just build it once to check for
4:46
let's see the esp8266 dot see now again
4:58
we need to change the UART handlers
5:00
according to our setup my Wi-Fi is
5:07
connected to UART one and computer to
5:10
UART two this is the HTML code for the
5:15
web page it contains four sections
5:19
initial part led on LED off and the
5:23
ending part you can change this
5:27
according to your convenience let's see
5:32
the initialization function first reset
5:36
the ESP and wait for five seconds for it
5:40
to settle next we will send a tea and
5:45
wait for okay response next command is
5:49
CW mode equals to 1 this will set the
5:52
module in the station mode next command
5:56
is to join the access point provided in
5:58
the parameter of this function
6:06
CIFS our command is to query for the IP
6:09
address and finally we will start the
6:13
server at port 80 server send will send
6:24
the string to the device which is trying
6:26
to connect to this IP address server
6:32
handle is to handle the requests for
6:34
different pages like what to do
6:37
if the LED on request is received or LED
6:41
off request is received basically we
6:44
will send the initial part than LED on
6:47
and then the ending part to the server
6:50
server start will read the incoming
6:53
request and then proceeds accordingly
6:56
let's write the main functions now first
7:00
of all we need to initialize the ESP I
7:03
have created a hotspot on my phone and
7:06
these are the credentials for it
7:09
now put server start in the while loop
7:12
and that's it let's debug it now click
7:25
let's run it now you can see the output
7:32
on the console here 80 is okay and now
7:36
it is connecting to the access point it
7:39
have returned our IP address my another
7:43
phone is also connected to the same
7:45
access point we will go to the IP
7:48
address and here we got our webpage
7:51
notice the LED on board
8:18
so everything is working all right
8:22
nothing happens when we refresh the page
8:33
you can download the code from the link
8:36
in the description I will keep updating
8:39
this code in future and all the new
8:42
details will be published on the website
8:45
I will try making a data logger using
8:48
Wi-Fi this is it guys I hope you will
8:53
make some good use of it have a nice day