This repository contains an Arduino sketch for setting up an ESP32-based web server capable of serving HTTP requests and flashing an LED in Morse code. Additionally, it includes a Flutter application for interacting with the web server, fetching data, and sending Morse code messages.
- Web Server: Utilizes the ESP32's capabilities to create a simple HTTP server.
- JSON Response: Provides a JSON response endpoint for retrieving predefined messages.
- Morse Code Flashing: Parses custom messages and flashes an LED in Morse code accordingly.
- Easy Integration: Straightforward setup and usage, suitable for beginners and experienced developers alike.
- Clone the Repository: Clone this repository to your local machine.
- Install Libraries: Ensure you have the required libraries installed. The necessary libraries are
WiFi
,WebServer
, andArduinoJson
. - Configure WiFi: Replace
"your-ssid"
and"your-password"
with your WiFi credentials in thessid
andpassword
variables. - Hardware Setup: Connect an LED to pin 2 (or modify
ledPin
if using a different pin) of your ESP32 board. - Upload the Sketch: Upload the provided sketch (
esp32_web_server.ino
) to your ESP32 board using the Arduino IDE or platform of your choice.
- Access the
/data
endpoint in your browser or through a tool like cURL to receive a predefined JSON message and see the LED flash. - Send a POST request to the
/morse
endpoint with amessage
parameter containing the text you want to convert to Morse code. The ESP32 will flash the LED accordingly and respond with a confirmation message.
The repository also includes a Flutter application (flutter_demo_for_using_esp_server
) for interacting with the ESP32 web server.
- Fetch Data: Fetches predefined data from the ESP32 web server.
- Send Morse Request: Sends custom messages to the ESP32 web server to be flashed in Morse code.
- Visual Feedback: Displays response messages and loading indicators for user feedback.
- Update the IP Address: Obtain the IP address of your ESP32 and update the URL in the Flutter application (
lib/main.dart
) with the correct IP address. - Run the Application: Run the Flutter application on your mobile device or emulator.
- Fetch Data: Press the "Fetch Data" button to fetch predefined data from the ESP32 web server.
- Send Morse Request: Press the "Send Morse Request" button to send a custom message to be flashed in Morse code by the ESP32.
- Medium Article: Read the detailed tutorial on building the ESP32 web server and integrating it with Flutter.
- ESP32 Documentation: Explore the ESP32 documentation for more information on the HTTP server capabilities.
Contributions to this project are welcome! Feel free to fork this repository, make changes, and submit a pull request. If you encounter any issues or have suggestions for improvements, please open an issue.