Hopefully and easy question for you all. I'm pretty new at this and I was trying to run some examples for the wifi. Problem is, our SSID has an apostrophe in the name. It's not recognizing it as text. So, for example, our SSID is, "Joe's Cafe". How do you setup the syntax for that? Already tried the "_" and that didn't help. I also tried just not having it. Ie; "Joes Cafe". any ideas? Tia!
Hi @gasnowlady, welcome to the forum.
What isn't? The compiler? Could your post the error messages?
While special characters are technically allowed, some devices or the compiler may have trouble with some them. Spaces, underscores and percent signs are among those that can be problematic and are best avoided.
If you use "JoesCafe" without space or underscore, does it then work?
(As an option, the above note regarding special characters notwithstanding, you could try "Joe`s~Cafe" i.e using a backtick and a tilda.)
In the Arduino_secrets.h file. The one where you change the SSID and the password to match your own network. In the examples drop down under WIFI. All the text is orange. If I put an apostrophe, the text turns white after the apostrophe. I will try your suggestion.
Does it stay white when you add the closing double-quote?
Hi, try adding a backslash before the single quote \'
The two strings start out empty, with no text between the quotes
#define SECRET_SSID ""
#define SECRET_PASS ""
In the default color scheme, the macro names like SECRET_SSID are orange. It will turn white if you put the apostrophe there: SEC'RET_SSID. But that's not where it goes; it should be
#define SECRET_SSID "Joe's Cafe"
The color of the literal string should not change (blue-green?); there's no issue at the C++ language level to have a single-quote inside double-quotes.
If that still doesn't work, it's possible that it's not a simple "ASCII apostrophe", which is technically U+0027. One of the WiFi Examples on Giga (and other boards) is ScanNetworksAdvanced, which will print the SSID of every AP it can see, e.g.
8) Signal: -62 dBm Channel: 11 BSSID: 15:FA:23:33:26:34
Encryption: WPA2 SSID: Joe's Cafe
The example can be amended to show the exact bytes being reported. Change
to
Serial.print("\t\tSSID: ");
String ssid {WiFi.SSID(thisNet)};
Serial.println(ssid);
if (ssid.startsWith("Joe") && ssid.endsWith("afe")) {
char buf[4];
for (int i = 0; i < ssid.length(); i++) {
snprintf(buf, sizeof(buf), "%02X\040", ssid.charAt(i));
Serial.print(buf);
}
Serial.println();
}
so that it prints something like
8) Signal: -62 dBm Channel: 11 BSSID: 15:FA:23:33:26:34
Encryption: WPA2 SSID: Joe's Cafe
4A 6F 65 27 73 20 43 61 66 65
That 27 is the apostrophe. Do you see something different?
Thank you KenB4--that look's like it might work. I knew it was something silly.