![]() ![]() Important: you may need to restart your router for the changes to take effect.Īfter this, if you go to your router settings, you’ll see the ESP32 with the custom hostname. It is possible to get it connected by sending wifi 0 and wifi 1 commands via serial terminal (sometimes it is needed to send them more than once). You can use this previous snippet of code in your projects to set a custom hostname for the ESP32. An ESP32-based device (ESP32 DEVKITV1 with ESP-WROOM-32 module) often fails to connect to a FRITZBox 7530 router via WiFi, at the startup. put your main code here, to run repeatedly: wifi_station_set_hostname( hostname.c_str() ) nfig(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE) ![]() String hostname = "ESP32 Node Temperature" Replace with your network credentials (STATION)Ĭonst char* ssid = "REPLACE_WITH_YOUR_SSID" Ĭonst char* password = "REPLACE_WITH_YOUR_PASSWORD" The above copyright notice and this permission notice shall be included in allĬopies or substantial portions of the Software. Of this software and associated documentation files. Permission is hereby granted, free of charge, to any person obtaining a copy You can copy the complete example below: /* tHostname(hostname.c_str()) //define hostname You also need to call nfig() as shown below: nfig(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE) Then, call the tHostname() function before calling WiFi.begin(). For example: String hostname = "ESP32 Node Temperature" There is a method provided by the WiFi.h library that allows you to set a custom hostname.įirst, start by defining your new hostname. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |