Page 1 of 1

ESP32-CAM bad hostname

Posted: Tue Sep 24, 2019 4:33 pm
by stroked_papy
Hello
When I tried this code

Code: Select all

#include "esp_camera.h"
#include <WiFi.h> 

#include "camera_pins.h" 
const char* ssid = "xxxxxxxxxx";
const char* password = "xxxxxx";
const char* hostname = "Sillage";

// Set your Static IP address
IPAddress local_IP(192, 168, 1, 208);
// Set your Gateway IP address
IPAddress gateway(192, 168, 1, 1);

IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(192, 168, 1, 1);   //optional
IPAddress secondaryDNS(192, 168, 1, 1);   //optional

void setup() {
........

WiFi.disconnect(); //Prevent connecting to wifi based on previous configuration
  
  WiFi.setHostname(hostname);
  
// Configures static IP address
  if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("STA Failed to configure");
  }
  
  WiFi.begin(ssid, password);
  ............
  
I have IP address 192.168.1.208 but the hostname as 192.168.1.208

When i tried with a dynamic hostname is wake Sillage

What is the problem

thank you so much