The use of the ESP8266 in the world of IoT

User avatar
By JJJ_GU
#16652 This is my code, it works today after some modification. Also I still don't know why but u can try it
Code: Select all   struct softap_config SA_config;
   unsigned int i;
      
   os_sprintf(SA_config.ssid,"IOT_ESP");
   os_memcpy(&SA_config.password,"123456789",32);
   SA_config.channel=1;
   SA_config.authmode=AUTH_WPA2_PSK;
   SA_config.ssid_hidden=0;
   SA_config.max_connection=4;
   SA_config.beacon_interval=200;
   
   /*****Set wifi SSID and password*****/
   
  uart_init(115200,115200); 

   os_printf("\n SDK version:%s\n", system_get_sdk_version());
   os_printf("Wifi mode:%d\n", wifi_get_opmode());
   os_printf("Station+SA set:%d\n", wifi_set_opmode_current(0x02));
   //os_printf("SA config set initial:%d\n", wifi_softap_get_config_default(&SA_config));
   os_printf("SA config set:%d\n", wifi_softap_set_config_current(&SA_config));
   //delay (1000)
   os_delay_us(500000);
   
   os_printf("SA DHCP start:%d\n", wifi_softap_dhcps_start());
   os_printf("Wifi name:%s\n", SA_config.ssid);
   os_printf("Wifi password:%s\n", SA_config.password);