Hello,
I am trying to compare the results of WiFi.SSID against a known SSID (in the form of a char array) to determine whether a certain network is within range. Even though both read exactly the same when I print via the serial monitor, my comparison logic always returns false. I have come to believe that this may be caused by the fact that WiFi.SSID returns a char* and not a string as the documentation states since when I try to write the result of the call to an existing char array, I get "error: incompatible types in assignment of 'char*' to 'char [20]'". Pointers are definitely not my strong suit - can anyone help me get this comparison to work correctly?
This is the code that never returns found, even though it prints out the SSID in question.
byte num = WiFi.scanNetworks();
boolean found = false;
char ssid[] = "mySSID";
Serial.println(ssid);
for (byte i = 0; i < num; i++) {
Serial.println(WiFi.SSID(i));
if (WiFi.SSID(i) == ssid) {
found = true;
Serial.println("Found");
}
}