Allo j’aimerais savoir comment faire pour faire un nom domaine fictive pour mon Webserver sur mon nodemcu voici un code de base j’aimerais faire « test.com » qui redirect a mon 192.168.1.1 quand je l’écris dans une page web, je l’utilise en AP sans être connecté sur internet je ces qui a le mode local « test.local » mais ça fonctionne pas jais testé plein tuto du ESP8266mDNS.h mais rien fonctionne !!!! mais ces possible de le faire sans le .local mais un .com ou .net ect…. Merci !
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#define LED_BUILTIN D2
const char *ssid = "AP";
const char *password = "Password";
IPAddress ip(192,168,1,1);
IPAddress subnet(255,255,255,0);
WiFiServer server(80);
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
Serial.println();
Serial.println("Configuring access point...");
WiFi.softAP(ssid, password);
WiFi.softAPConfig(ip, ip, subnet);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
}
void loop()
{
WiFiClient client = server.available();
if (client)
{
Serial.println("New Client.");
String currentLine = "";
while (client.connected())
{
if (client.available())
{
char c = client.read();
Serial.write(c);
if (c == '\n')
{
if (currentLine.length() == 0)
{
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.print("Click <a href=\"/H\"><button>ON</button></a> to turn ON the LED.
");
client.print("Click <a href=\"/L\"><button>OFF</button></a> to turn OFF the LED.
");
client.println();
break;
}
else
{
currentLine = "";
}
}
else if (c != '\r')
{
currentLine += c;
}
if (currentLine.endsWith("GET /H"))
{
digitalWrite(LED_BUILTIN, HIGH);
}
if (currentLine.endsWith("GET /L"))
{
digitalWrite(LED_BUILTIN, LOW);
}
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
void changeStateon()
{
digitalWrite(LED_BUILTIN, LOW);
}