Controllerstech-Co
Controllerstech-Co
Ad
Below is the CubeMX setup. Two UARTs are being used. One is connected to the
ESP8266, and another is connected to the computer.
ADVERTISEMENT
Ads by
Stakeholders Voice Concerns, Push Back on NCD for NGS Cancer Panels
GenomeWeb
Ad
keyboard_arrow_up
esp8266 setup
esp8266 connection
Ringbuf_init();
Uart_sendstring("AT+RST\r\n", wifi_uart);
Uart_sendstring("RESETTING.", pc_uart);
for (int i=0; i<5; i++)
{
Uart_sendstring(".", pc_uart);
HAL_Delay(1000);
}
/********* AT **********/
Uart_sendstring("AT\r\n", wifi_uart);
while(!(Wait_for("AT\r\r\n\r\nOK\r\n", wifi_uart)));
Uart_sendstring("AT---->OK\n\n", pc_uart);
ESP_Init (“SSID”, “PASSWD”) Initialises the ESP8266. Its parameter are the SSID
and PASSWD of the Access point that you want to connect to. This function sends
some AT commands in a sequence, and than waits for the expected response after
every command. These commands are given below
AT+CWJAP=”SSID”, “PASSWD” –> Join the access point with the SSID, and
PASSWD
esp8266 output
Ad
0:26
Next, we will connect to this IP address, but make sure the device and the ESP
should be connected to the same network.
server start
else
{
HAL GPIO WritePin(GPIOA, GPIO PIN 5, 0);
Server_Start() checks the incoming connection, and look for the request made by
the browser. If the request is about ledon, or ledoff, or the root. Once identified, it
will call the Server_Handle to handle that request
If the request is made for the root, or ledoff the following will be displayed on the
browser
esp8266 root
Note that the LED on board is OFF right now. There is a option displayed on the web
browser to turn this LED ON.
If we tap this ON button, a ledon request will be sent to the ESP, and the
Server_Start will call Server_Hnadle to handle this ledon request.
esp8266 ledon
Now the LED is ON, and there is a OFF button to turn it OFF.
The web page source code is divided into 3 categories
Button and Status part, which will depend on what request is being
processed
Initial part
To make this entire thing work, all you have to do is as shown below
main function
while (1)
{
Server_Start();
}
}
In case you are using a microcontroller, which gave you error on Uart_isr
function. Errors like DR and SR are not present, replace the Uart_isr code with
the following file Uart_isr.c
Ad
Result
esp8266 ledoff
esp8266 ledon
Ad
DOWNLOAD DONATE
Related Posts:
49 Comments. Leave
new
Ali Akbar
February 1, 2024 8:10 PM
Reply
Harsh
November 4, 2023 8:20 AM
Reply
Prashanth
November 1, 2023 7:09 PM
My Code is stuck at
while (!IsDataAvailable(uart));
if (Uart_peek(uart) != string[so_far])
{
_rx_buffer1->tail = (unsigned int)
(_rx_buffer1->tail + 1) %
UART_BUFFER_SIZE ;
goto again_device;
Reply
Ilham
July 30, 2022 7:17 AM
Reply
admin
July 30, 2022 10:22 AM
Reply
Reply
Ian LY
June 19, 2022 8:41 PM
Example :
During the “Resetting…..” issue
Device waiting response,
while(!
(Wait_for(“AT\r\r\n\r\nOK\r\n”,
wifi_uart)));
Fix with the correct response,
while(!(Wait_for(“OK”,
wifi_uart)));
AT
OK
AT+CWMODE=1
OK
AT+CWJAP=”ssid”,”pass”
WIFI CONNECTED
WIFI GOT IP
OK
AT+CIFSR
+CIFSR:STAIP,”ip_address”
+CIFSR:STAMAC,”mac_number”
OK
AT+CIPMUX=1
OK
AT+CIPSERVER=1,80
OK
Reply
Jhon Wick
April 23, 2023 5:02 AM
Reply
Jongwoon Choi
January 29, 2022 8:17 PM
Hello,
I have tried to read your ring_buffer
code,
It is not easy for me to see why you
used ‘rx_buffer1’ and ‘_rx_buffer1’.
Would you explain the role of
‘rx_buffer1’ and ‘_rx_buffer1’?
sincerely yours,
Reply
Jongwoon Choi
January 30, 2022 6:09 PM
Reply
Goto Simon
January 27, 2022 3:36 AM
Reply
Jongwoon Choi
January 22, 2022 5:53 PM
Hello,
I have tried to port this program to
stm32h7xx board, it was compiled
well without error.
But there was no response from the
board. And I have debugged it, it
was stopped at the end of
“Uart_write” function. I still did not
know why it was stopped.
Would you help me?
Reply
Jongwoon Choi
January 19, 2022 12:05 PM
Hello,
Thanks for the nice program to learn
the usage of ESP8266 with STM32.
I checked this program is worked
very well in normal conditions.
Reply
Jongwoon Choi
January 19, 2022 12:20 PM
Reply
Jongwoon Choi
January 13, 2022 2:31 PM
Hello,
I am trying to run this job on
stm32h743, but there is some
compile error.
It is because usage of low-level
interrupt call as
READ_REG(huart->Instance->SR)
or
READ_REG(huart->Instance->DR)
the compiler generates an error
because of usage of SR, DR.. et.al.
Reply
admin
January 13, 2022 4:05 PM
Reply
Jongwoon Choi
January 14, 2022 10:14 AM
Reply
Jongwoon Choi
January 21, 2022 11:27 AM
Reply
Jongwoon Choi
January 21, 2022
11:28 AM
Yash1t
November 8, 2021 12:01 PM
Hello,
PLEASE HELP!!!!
Reply
Nacef Khadraoui
August 12, 2021 5:26 PM
Reply
Karl Simmons
May 3, 2021 4:37 PM
Great tutorial!:)
Reply
HOSEIN
April 30, 2021 4:12 PM
Reply
Reply
Yash1t
November 8, 2021 12:09 PM
Reply
amir
April 26, 2021 9:46 PM
Hello
If you can explain these 3 lines
further:
Reply
amir
April 27, 2021 11:53 AM
Link_ID – = 48;
(48)==???
Reply
Kasem KWANGSAKUL
July 7, 2021 8:22 AM
Reply
Pagiiiii
February 9, 2021 3:21 PM
Reply
Reply
Soroush
January 31, 2021 9:30 PM
Reply
admin
January 31, 2021 10:19 PM
try now
Reply
Chris
November 18, 2020 3:00 AM
Thanks
Reply
Kasem KWANGSAKUL
November 10, 2020 2:06 PM
Reply
admin
November 11, 2020 7:55 PM
Reply
Kasem KWANGSAKUL
November 12, 2020 11:31 AM
Reply
Kasem KWANGSAKUL
November 14, 2020 8:47 AM
Reply
Chris
November 18, 2020 2:49 AM
Thanks
Reply
Arthur
September 24, 2020 12:45 AM
if(IsDataAvailable(pc_uart))
{
Reply
admin
September 24, 2020 1:29 PM
Reply
Pedro
June 11, 2020 8:18 AM
Tudo bem!
Muito bom seu trabalho, poderia
postar um exemplo pro stm32f103?
Reply
admin
June 13, 2020 3:25 PM
Reply
Reply
admin
May 22, 2020 8:17 PM
Reply
lucas
April 29, 2020 7:20 PM
Bom dia!
copiei o exemplo para o stm32f103,
o mesmo não responde na serial
habilitei as interrupções!
Reply
admin
May 12, 2020 10:21 AM
Reply
Lucas
May 24, 2020 10:04 AM
Reply
Denisa
April 25, 2020 10:51 PM
Reply
Lucas
May 10, 2020 8:41 PM
Reply
Leave a Reply
Your email address will not be
published. Required fields are
marked *
Comment *
Name *
Email *
Post Comment
HOME
ABOUT US
Privacy Policy
SHOP WITH US
DONATE HERE
CONTACT US
Search