Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: **Web Server** - Source Code NOT compiled for: ESP32 DevKit V1 - Source Code created on: 2024-10-14 21:00:53 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* integrate the two codes adjusting everything with */ /* ESPAsyncWebServer and SPIFFS. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ /****** DEFINITION OF LIBRARIES *****/ #include
#include
#include
/****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); // Create an instance of the server AsyncWebServer server(80); // WiFi credentials const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; void setup(void) { // Start Serial communication for debugging Serial.begin(115200); // Initialize SPIFFS if (!SPIFFS.begin(true)) { Serial.println("SPIFFS Mount Failed"); return; } // Connect to Wi-Fi WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi..."); } Serial.println("Connected to WiFi"); // Serve the index.html file from SPIFFS server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SPIFFS, "/index.htm", "text/html"); }); // Handle 404 Not Found server.onNotFound([](AsyncWebServerRequest *request){ request->send(404, "text/plain", "Not found"); }); // Start the server server.begin(); } void loop(void) { // Main loop does nothing, all handling is done in callbacks } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)