Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By tonus@gmx.us
#59394 @JimDrew

In this order like this:
WiFi.hostname("BeMyGuest");
WiFi.begin(ssid, pass);


Only cast something if you know what you are doing!
Compiler warnings are there to WARN you, but you are the boss....

String routername = "Testing123"; // routername is of type String
// you intended: char *ourname=routername.c_str();
char* ourname = &routername[0]; // ourname points to the first element of the ARRAY routername???
wifi_station_set_hostname(ourname); /sets hostname to somewhat in the bitbucket

You intended this:
WiFi.hostname("Testing123"); // best to do after intstantiating and before anything else
WiFi.begin(ssid, pass); // here the WiFi starts talking to your router and may give its name "Testing123" to the router