Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: **Wi-Fi Server**
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2025-03-19 15:30:23
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* I want to connect my esp32 to MIT app inventor so */
- /* i could control my system via app */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <WiFi.h>
- #include <ESPAsyncWebServer.h>
- #include <ArduinoJson.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- // WiFi credentials
- const char* ssid = "your_SSID"; // Replace with your network SSID
- const char* password = "your_PASSWORD"; // Replace with your network password
- // Create an instance of the server on port 80
- AsyncWebServer server(80);
- void setup(void)
- {
- // Initialize Serial for debugging
- Serial.begin(115200);
- // 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");
- // Define a route for the root URL
- server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
- request->send(200, "text/plain", "Hello from ESP32");
- });
- // Start the server
- server.begin();
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement