Page 1 of 1

How to use: esp_wifi_get_country(wifi_country_t *country)

Posted: Thu Jun 20, 2019 12:41 pm
by hml9083@hotmail.com
I can execute the command for esp_err_t esp_wifi_set_country(const wifi_country_t *country)
I have set the country to "US" with out getting an error.
I can not execute the command esp_err_t esp_wifi_get_country(const wifi_country_t *country)
country variable type I use is char*.
Are there any examples of retrieving the country code using the Arduino IDE?
I always get errors trying to get the country code

Re: How to use: esp_wifi_get_country(wifi_country_t *country)

Posted: Thu Jun 20, 2019 5:50 pm
by boarchuz
Try something like this.

Code: Select all

wifi_country_t myCountry;
if(esp_wifi_get_country(&myCountry) == ESP_OK){
  Serial.print("Country Code: ");
  Serial.println(myCountry.cc);
 }

Re: How to use: esp_wifi_get_country(wifi_country_t *country)

Posted: Fri Jun 21, 2019 9:53 pm
by hml9083@hotmail.com
Thank you boarchuz, got it working now.