I cannot connect to Wi-fi on my ESP32 DEV-KIT; I have a String
which contains ssid and password, but the WIFI.begin()
function accepts only const char*
, and I don't know how to convert String
to const char*
. I have tried the c_str()
function, but the result I am getting is != (not equal) to the actual ssid.
String ssid = "DIR-615A";
char ssidR;
const char* ssidR2 = "DIR-615A";
void setup() {
ssidR = ssid.c_str();
Serial.println(ssidR);
Serial.println(ssidR2);
Serial.println(ssidR == ssidR2); //this returns 0
}
Both ssidR and ssidR2 look identical when printing them, but when I use ssidR to connect to wi-fi, it is not working.