ESP8266 Developer Zone The Official ESP8266 Forum 2016-06-23T22:01:12+08:00 https://bbs.espressif.com:443/feed.php?f=31&t=227 2016-06-23T22:01:12+08:00 2016-06-23T22:01:12+08:00 https://bbs.espressif.com:443/viewtopic.php?t=227&p=7484#p7484 <![CDATA[Re: [ESP8266] SoftAP Config]]>
I am trying to connect to wifi with an iphone. Does that produce a specific problem?

Statistics: Posted by disideris — Thu Jun 23, 2016 10:01 pm


]]>
2015-02-27T16:38:47+08:00 2015-02-27T16:38:47+08:00 https://bbs.espressif.com:443/viewtopic.php?t=227&p=834#p834 <![CDATA[[ESP8266] SoftAP Config]]> :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:

/******************************************************************************
 * 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();

}

Statistics: Posted by ESP_Faye — Fri Feb 27, 2015 4:38 pm


]]>