[ESP8266] SoftAP Config

ESP_Faye
Posts: 1615
Joined: Mon Oct 27, 2014 11:08 am

[ESP8266] SoftAP Config

Postby ESP_Faye » Fri Feb 27, 2015 4:38 pm

:idea: :idea: :idea:

Sample code below is based on ESP8266_NONOS_SDK.

Set SSID, password and other information about ESP8266 soft-AP.

Download blank.bin to flash for initialization.

Please notice that wifi_softap_get_config(&softap_config); // Get config first is recommended to be called first.
Or you have to set value for every parameter in softap_config, for example, softap_config.beacon_interval and softap_config.ssid_len, otherwise they will be random value which may make ESP8266 softAP hardly to be connected.

Code: Select all

/******************************************************************************
 * FunctionName : user_set_softap_config
 * Description  : set SSID and password of ESP8266 softAP
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
user_set_softap_config(void)
{
   struct softap_config config;

   wifi_softap_get_config(&config); // Get config first.
   
   os_memset(config.ssid, 0, 32);
   os_memset(config.password, 0, 64);
   os_memcpy(config.ssid, "ESP8266", 7);
   os_memcpy(config.password, "12345678", 8);
   config.authmode = AUTH_WPA_WPA2_PSK;
   config.ssid_len = 0;// or its actual length
   config.beacon_interval = 100;
   config.max_connection = 4; // how many stations can connect to ESP8266 softAP at most.

   wifi_softap_set_config(&config);// Set ESP8266 softap config .
   
}


/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{
    os_printf("SDK version:%s\n", system_get_sdk_version());
       
    wifi_set_opmode(SOFTAP_MODE);

    // ESP8266 softAP set config.
    user_set_softap_config();

}

disideris
Posts: 2
Joined: Thu Jun 23, 2016 9:38 pm

Re: [ESP8266] SoftAP Config

Postby disideris » Thu Jun 23, 2016 10:01 pm

i see the essid and when i put the password doesn't connect.

I am trying to connect to wifi with an iphone. Does that produce a specific problem?

design444
Posts: 2
Joined: Fri Jan 20, 2017 5:35 pm

Re: [ESP8266] SoftAP Config

Postby design444 » Fri Jan 20, 2017 5:46 pm

thank you for sharing this information.I would really like to visit your website.thank you so much.its code is helpful for me .
i appreciated for this post.thank you

Layla508
Posts: 1
Joined: Fri Jan 20, 2017 9:02 pm

Re: [ESP8266] SoftAP Config

Postby Layla508 » Fri Jan 20, 2017 9:04 pm

Thanks for the post! I`ll visit this website. It may be useful for my colleagues.

Who is online

Users browsing this forum: Bing [Bot] and 1 guest