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-11-16 14:40:10 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* The system shall utilize the Sim800L module for */ /* GSM communication, ensuring reliable data */ /* transmission and reception via SoftwareSerial on */ /* specified pins. It must handle reset and DTR */ /* signals effectively for optimal performance. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/plerup/espsoftwareserial #include
//https://github.com/vittorioexp/Sim800L-Arduino-Library-revised #include
//https://github.com/soylentOrange/Forced-BMX280 #include
// Include WiFi library for ESP32 #include
// Include WebServer library for handling HTTP requests /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void handleRoot(); // Function to handle root URL void handleLogin(); // Function to handle login void handleSignup(); // Function to handle signup void handleProfile(); // Function to handle profile page /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t Ny_SIM800L_RING_PIN_RX2 = RX2; /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t Ny_SIM800L_RST_PIN_D14 = 14; const uint8_t Ny_SIM800L_DTR_PIN_TX2 = TX2; /***** DEFINITION OF Software Serial *****/ const uint8_t Ny_SIM800L_Serial_PIN_SERIAL_TX_D4 = 4; const uint8_t Ny_SIM800L_Serial_PIN_SERIAL_RX_D13 = 13; SoftwareSerial Ny_SIM800L_Serial(Ny_SIM800L_Serial_PIN_SERIAL_RX_D13, Ny_SIM800L_Serial_PIN_SERIAL_TX_D4); /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ bool Ny_SIM800L_RST_PIN_D14_rawData = 0; bool Ny_SIM800L_DTR_PIN_TX2_rawData = 0; /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ float Ny_SIM800L_RST_PIN_D14_phyData = 0.0; float Ny_SIM800L_DTR_PIN_TX2_phyData = 0.0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ // Initialize the web server on port 80 WebServer server(80); Sim800L sim800l(Ny_SIM800L_Serial_PIN_SERIAL_RX_D13, Ny_SIM800L_Serial_PIN_SERIAL_TX_D4, Ny_SIM800L_RST_PIN_D14); // Instantiate Sim800L object void setup(void) { // put your setup code here, to run once: pinMode(Ny_SIM800L_RING_PIN_RX2, INPUT_PULLUP); pinMode(Ny_SIM800L_RST_PIN_D14, OUTPUT); pinMode(Ny_SIM800L_DTR_PIN_TX2, OUTPUT); // Initialize Software Serial for SIM800L Ny_SIM800L_Serial.begin(9600); // Initialize SIM800L sim800l.begin(9600); // Set baud rate for SIM800L // Start WiFi connection WiFi.begin("YOUR_SSID", "YOUR_PASSWORD"); // Replace with your WiFi credentials while (WiFi.status() != WL_CONNECTED) { delay(1000); } // Define routes server.on("/", handleRoot); server.on("/login", handleLogin); server.on("/signup", handleSignup); server.on("/profile", handleProfile); // Start server server.begin(); } void loop(void) { // put your main code here, to run repeatedly: updateOutputs(); // Refresh output data server.handleClient(); // Handle incoming client requests } void updateOutputs() { digitalWrite(Ny_SIM800L_RST_PIN_D14, Ny_SIM800L_RST_PIN_D14_rawData); digitalWrite(Ny_SIM800L_DTR_PIN_TX2, Ny_SIM800L_DTR_PIN_TX2_rawData); } void handleRoot() { // Serve the login page server.send(200, "text/html", R"rawliteral(
WeEarnZA - Get Started
Participate and Earn
Login
Sign IN
Sign Up
)rawliteral"); } void handleLogin() { // Here you would implement the login logic // For now, just redirect to the profile page server.sendHeader("Location", "/profile"); server.send(303); // 303 See Other } void handleSignup() { // Serve the signup page (similar to login) server.send(200, "text/html", R"rawliteral(
Sign Up
Sign Up
Sign Up
Back to Login
)rawliteral"); } void handleProfile() { // Serve the profile page server.send(200, "text/html", R"rawliteral(
Profile
User Profile
Username: [Username]
Balance: R88.00
Logout
)rawliteral"); } /* 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)