64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#include <WiFi.h>
|
|
|
|
|
|
|
|
/*********
|
|
Rui Santos
|
|
Complete project details at http://randomnerdtutorials.com
|
|
*********/
|
|
|
|
// Load Wi-Fi library
|
|
|
|
// Replace with your network credentials
|
|
const char *ssid = "ESP1 - AP";
|
|
const char* password = "12345678";
|
|
const int LED = 2;
|
|
|
|
// Set web server port number to 80
|
|
WiFiServer server(80);
|
|
|
|
// Variable to store the HTTP request
|
|
String header;
|
|
|
|
// Auxiliar variables to store the current output state
|
|
String output2State = "off";
|
|
|
|
|
|
// Current time
|
|
unsigned long currentTime = millis();
|
|
// Previous time
|
|
unsigned long previousTime = 0;
|
|
// Define timeout time in milliseconds (example: 2000ms = 2s)
|
|
const long timeoutTime = 2000;
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
// Initialize the output variables as outputs
|
|
pinMode(LED, OUTPUT);
|
|
// Set outputs to LOW
|
|
digitalWrite(LED, LOW);
|
|
|
|
//PA
|
|
Serial.println();
|
|
Serial.println("Configuration du point d'accès...");
|
|
WiFi.softAP(ssid, password);
|
|
|
|
IPAddress apIP = WiFi.softAPIP();
|
|
Serial.print("AP adresse IP: ");
|
|
Serial.println(apIP);
|
|
|
|
Serial.println("");
|
|
Serial.println("WiFi connected.");
|
|
Serial.println("IP address: ");
|
|
Serial.println(apIP);
|
|
server.begin();
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop(){
|
|
|
|
}
|