mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Revert "fixed typos, brought back LED to blink"
This reverts commit 6014297bf2e6e9eff1c4a695cf37b8723b8487cc.
This commit is contained in:
parent
6f4ba91698
commit
29a8c57ff5
@ -6,18 +6,14 @@
|
|||||||
const char* ssid = "........";
|
const char* ssid = "........";
|
||||||
const char* password = "........";
|
const char* password = "........";
|
||||||
MDNSResponder mdns;
|
MDNSResponder mdns;
|
||||||
|
|
||||||
ESP8266WebServer server(80);
|
ESP8266WebServer server(80);
|
||||||
|
|
||||||
const int led = 13;
|
|
||||||
|
|
||||||
void handle_root() {
|
void handle_root() {
|
||||||
digitalWrite(led, 1);
|
|
||||||
server.send(200, "text/plain", "hello from esp8266!");
|
server.send(200, "text/plain", "hello from esp8266!");
|
||||||
digitalWrite(led, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool handle_not_found(){
|
bool handle_not_found(){
|
||||||
digitalWrite(led, 1);
|
|
||||||
String message = "URI: ";
|
String message = "URI: ";
|
||||||
message += server.uri();
|
message += server.uri();
|
||||||
message += "\nMethod: ";
|
message += "\nMethod: ";
|
||||||
@ -30,14 +26,11 @@ bool handle_not_found(){
|
|||||||
}
|
}
|
||||||
message += "\nNotFound!";
|
message += "\nNotFound!";
|
||||||
server.send(404, "text/plain", message);
|
server.send(404, "text/plain", message);
|
||||||
digitalWrite(led, 0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(void){
|
void setup(void){
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
pinMode(led, OUTPUT);
|
|
||||||
digitalWrite(led, 0);
|
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
|
@ -42,16 +42,15 @@ public:
|
|||||||
typedef std::function<bool(void)> TNotFoundHandlerFunction;
|
typedef std::function<bool(void)> TNotFoundHandlerFunction;
|
||||||
void on(const char* uri, THandlerFunction handler);
|
void on(const char* uri, THandlerFunction handler);
|
||||||
void on(const char* uri, HTTPMethod method, THandlerFunction fn);
|
void on(const char* uri, HTTPMethod method, THandlerFunction fn);
|
||||||
//called when handler is not assigned, return true if you handle it else return false to let the class return 404
|
void onNotFound(TNotFoundHandlerFunction fn);//called when handler is not assigned
|
||||||
void onNotFound(TNotFoundHandlerFunction fn);
|
|
||||||
|
|
||||||
String uri() { return _currentUri; }
|
String uri() { return _currentUri; }
|
||||||
HTTPMethod method() { return _currentMethod; }
|
HTTPMethod method() { return _currentMethod; }
|
||||||
WiFiClient client() { return _currentClient; }
|
WiFiClient client() { return _currentClient; }
|
||||||
|
|
||||||
String arg(const char* name);// get request argument value
|
String arg(const char* name);// get request argument value
|
||||||
String arg(int i);// get request argument value by number
|
String arg(int i);// get request argument value buy number
|
||||||
String argName(int i);// get request argument name by number
|
String argName(int i);// get request argument name buy number
|
||||||
int args();//get arguments count
|
int args();//get arguments count
|
||||||
bool hasArg(const char* name);//check if argument exists
|
bool hasArg(const char* name);//check if argument exists
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user