Code: Select all
wifi_config_t wifi_config = {
.sta = {
.ssid = EXAMPLE_ESP_WIFI_SSID,
.password = EXAMPLE_ESP_WIFI_PASS
},
};
Code: Select all
wifi_config_t wifi_config = {
.sta = {
.ssid = EXAMPLE_ESP_WIFI_SSID,
.password = EXAMPLE_ESP_WIFI_PASS
},
};
Code: Select all
char *ssid = "mySsid";
chat *password = "mypassword";
wifi_config_t wifi_config;
memset(wifi_config, 0, sizeof(wifi_config);
strcpy(wifi_config.sta.ssid, ssid);
strcpy(wifi_config.sta.password, password);
... rest of logic
Hi,ankyankyanky wrote:I’m trying to figure out how to connect to an AP with credentials read from the flash storage. I’m new in C and is pretty much living on what is written in the examples. Unfortunately, all the examples are setting up WiFi with a wifi_config_t struct initialised with preprocessor directives like:
How do I change this code to operate with non hardcoded values? I’ve tried to initialise with variables, and changing wifi_config with dot notation and strcpy but have been unsuccessful so far.Code: Select all
wifi_config_t wifi_config = { .sta = { .ssid = EXAMPLE_ESP_WIFI_SSID, .password = EXAMPLE_ESP_WIFI_PASS }, };
Users browsing this forum: Google [Bot] and 127 guests