Adding deep sleep test sketch
This commit is contained in:
35
src/main.cpp
35
src/main.cpp
@@ -1,32 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
AsyncElegantOTA Demo Example - This example will work for both ESP8266 & ESP32 microcontrollers.
|
AsyncElegantOTA Demo Example - This example will work for both ESP8266 & ESP32
|
||||||
-----
|
microcontrollers.
|
||||||
Author: Ayush Sharma ( https://github.com/ayushsharma82 )
|
-----
|
||||||
|
Author: Ayush Sharma ( https://github.com/ayushsharma82 )
|
||||||
Important Notice: Star the repository on Github if you like the library! :)
|
|
||||||
Repository Link: https://github.com/ayushsharma82/AsyncElegantOTA
|
Important Notice: Star the repository on Github if you like the library! :)
|
||||||
|
Repository Link: https://github.com/ayushsharma82/AsyncElegantOTA
|
||||||
*/
|
*/
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESPAsyncTCP.h>
|
#include <ESPAsyncTCP.h>
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
#include <WiFi.h>
|
#include <AsyncTCP.h>
|
||||||
#include <AsyncTCP.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
#include <AsyncElegantOTA.h>
|
#include <AsyncElegantOTA.h>
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
const char* ssid = "JoNelsDarlings";
|
const char* ssid = "JoNelsDarlings";
|
||||||
const char* password = "Paris2016";
|
const char* password = "Paris2016";
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
|
|
||||||
void setup(void) {
|
void setup(void) {
|
||||||
Serial.begin(115200);
|
Serial.begin(9600);
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
@@ -42,14 +42,13 @@ void setup(void) {
|
|||||||
Serial.print("IP address: ");
|
Serial.print("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
request->send(200, "text/plain", "Hi! This is a sample response.");
|
request->send(200, "text/plain", "Hi! This is a sample response.");
|
||||||
});
|
});
|
||||||
|
|
||||||
AsyncElegantOTA.begin(&server); // Start AsyncElegantOTA
|
AsyncElegantOTA.begin(&server); // Start AsyncElegantOTA
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("HTTP server started");
|
Serial.println("HTTP server started");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(void) {
|
void loop(void) {}
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user