cancel
Showing results for 
Search instead for 
Did you mean: 

wifi who wants not connected

MHMallek
Associate II

Hello,

I want to connect esp8266 wifi using stm32f4 to an access point, I find that the module is not stable; sometimes it connects and sometimes no, I didn't understand why. can someone gone through that please help me?

here is my code and thanks in advance.

void connect_wifi(){

   uint8_t state=0;

   //restore "AT+RESTORE\r\n"

   Transmit_uart("AT+RESTORE\r\n");

   HAL_Delay(100);

   switch(state){

      case 0:

         //MODE

         Transmit_uart("AT+UART_DEF=115200,8,1,0,0\r\n");

         HAL_Delay(100);

         Transmit_uart("AT+CWMOD=1\r\n");

         HAL_Delay(100);

         state++;

      case 1:

         //acces point

         Transmit_uart("AT+CWJAP=\"p9\",\"azaz1212\"\r\n");

         HAL_Delay(5000);

         state++;

      case 2:

         //get ip

         Transmit_uart("AT+CIFSR\r\n");

         HAL_Delay(100);

       

         break;

   }

}

0 REPLIES 0