ESP32 - Hostname
Posted: Wed Mar 27, 2024 4:49 pm
Hello all,
I'm working on ESP32-WROOM-32E.
I made a connection to a wifi but I want to change the hostname but it doesn't work.
I don't understand from when the issue come.
Please find below the code
When I have a look on the BBox interface, the hostname is still ESP32-FCDKDML
Have you any idea of where the problem is coming from ?
Thanks for your help,
Antonin
I'm working on ESP32-WROOM-32E.
I made a connection to a wifi but I want to change the hostname but it doesn't work.
I don't understand from when the issue come.
Please find below the code
Code: Select all
#include <Arduino.h> //Basique ESP32
#include <WiFi.h> //Wifi ??
const char* ssid = "Bbox-641xxxxx";
const char* password = "xxxxxxxxxxxxx";
void setup() {
Serial.begin(115200);
delay(1000);
// Se connecter au réseau WiFi
Serial.println();
Serial.print("Connexion au réseau ");
Serial.println(ssid);
WiFi.disconnect(true,true);
delay(1000);
WiFi.setHostname("test1324");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connecté");
Serial.print("Adresse IP: ");
Serial.println(WiFi.localIP());
Serial.println("Hostname : ");
Serial.println(WiFi.getHostname());
}
void loop() {
}
Have you any idea of where the problem is coming from ?
Thanks for your help,
Antonin