I am trying to setup my ESP in SOFTAP mode and setting its SSID and password and also starting dhcp server. The code starts the ESP in SOFTAP mode and broadcasts its SSID, but when I try to connect to it, it does not connect to ESP. Am I missing something? Any pointers or fix to my code to make it working, so my phone can connect to the ESP in AP mode will be much appreciated.
Code: Select all
void ICACHE_FLASH_ATTR
user_single_led_init(void)
{
struct softap_config config;
char ssid[32] = "MyESPinC";
char password[33] = "AppleMBA";
char macaddr[6];
wifi_softap_get_config(&config);
wifi_get_macaddr(SOFTAP_IF, macaddr);
os_memset(config.ssid, 0, 32);
os_memcpy(config.ssid, ssid, 32);
os_memset(config.password, 0, sizeof(config.password));
os_memcpy(config.password, password, os_strlen(password));
config.authmode = AUTH_WPA_WPA2_PSK;
wifi_softap_set_config(&config);
wifi_set_opmode(STATIONAP_MODE);
wifi_softap_dhcps_start();
}