Hi,
I am getting an error during configuration of Wifi station mode , it is not getting connected to the given ssid and passwrd. .Please refer the below code
The ssid and passwrd has the valid data.
wifi_config_t sta_config ;
for(i=0;i<30;i++)
{
sta_config.sta.ssid = ssid;
sta_config.sta.password=passwrd;
}
but if I replace the above with hardcoded ssid and passwrd as given below it connects to the router immediately.
wifi_config_t sta_config = {
.sta = {
.ssid = "excellence",
.password = "vk123456"
},
};
Cant understand what is the issue ,I monitored the sta_config.sta.password & sta_config.sta.ssid strings both gives same value.But the first code snippet doesnt work. Pleaes help
Configuring Wifi Station mode for ESP32
Re: Configuring Wifi Station mode for ESP32
If you are using that structure as local variables, it will be uninitialized. Maybe this is your problem, because values inside this structure contain garbage values.
Maybe try it with an initialization like shown in the code above.
Code: Select all
wifi_config_t sta_config = {0};
for (int i = 0; i < 30; i++) {
sta_config.sta.ssid[i] = ssid[i];
sta_config.sta.password[i] = password[i];
}
Who is online
Users browsing this forum: No registered users and 101 guests