esp32-p4-hydra-wifi-http.ino

Adafruit Metro ESP32-P4 Hydra · File : esp32-p4-hydra-wifi-http.ino · Language : C++ (Arduino) · Use case : Se connecter à un réseau WiFi et servir une page web simple pour le contrôle à distance.

Uses the ESP32-C6 co-processor to establish a WiFi connection and host a minimal web server.

Modify the ssid and password constants with your network credentials. The C6 co-processor handles the radio connection. After uploading, note the IP address displayed in the Serial Monitor and access it via a web browser to see the HTML page.

esp32-p4-hydra-wifi-http.ino

#include <WiFi.h>
#include <WebServer.h>

const char* ssid = "VOTRE_SSID";
const char* password = "VOTRE_MOT_DE_PASSE";

WebServer server(80);

void handleRoot() {
  server.send(200, "text/html", "<h1>ESP32-P4 Hydra Serveur</h1><p>WiFi OK</p>");
}

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnecté ! IP: " + WiFi.localIP().toString());
  server.on("/", handleRoot);
  server.begin();
}

void loop() {
  server.handleClient();
}

← Back to the board