Skip to content

Commit 22ea72a

Browse files
committed
Add ESP8266WebServer library
1 parent 211045f commit 22ea72a

File tree

5 files changed

+500
-0
lines changed

5 files changed

+500
-0
lines changed

hardware/arduino/esp8266/cores/esp8266/abi.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ void __cxa_deleted_virtual(void) {
5252
abort();
5353
}
5454

55+
namespace std {
56+
void __throw_bad_function_call() {
57+
abort();
58+
}
59+
}
60+
5561

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <ESP8266WiFi.h>
2+
#include <WiFiClient.h>
3+
#include <ESP8266WebServer.h>
4+
5+
const char* ssid = "...............";
6+
const char* password = "...............";
7+
8+
9+
ESP8266WebServer server(80);
10+
11+
const int led = 13;
12+
13+
void handle_root() {
14+
digitalWrite(led, 1);
15+
server.send(200, "text/plain", form);
16+
delay(100);
17+
digitalWrite(led, 0);
18+
}
19+
20+
void setup(void)
21+
{
22+
Serial.begin(115200);
23+
pinMode(led, OUTPUT);
24+
digitalWrite(led, 0);
25+
26+
// Connect to WiFi network
27+
WiFi.begin(ssid, password);
28+
Serial.println("");
29+
30+
// Wait for connection
31+
while (WiFi.status() != WL_CONNECTED) {
32+
delay(500);
33+
Serial.print(".");
34+
}
35+
Serial.println("");
36+
Serial.print("Connected to ");
37+
Serial.println(ssid);
38+
Serial.print("IP address: ");
39+
Serial.println(WiFi.localIP());
40+
41+
server.on("/", handle_root);
42+
43+
server.on("/inline", [](){
44+
server.send(200, "text/plain", "this works as well");
45+
});
46+
47+
server.begin();
48+
Serial.println("HTTP server started");
49+
}
50+
51+
void loop(void)
52+
{
53+
server.handleClient();
54+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#######################################
2+
# Syntax Coloring Map For Ultrasound
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
ESP8266WebServer KEYWORD1
10+
HTTPMethod KEYWORD1
11+
12+
#######################################
13+
# Methods and Functions (KEYWORD2)
14+
#######################################
15+
16+
begin KEYWORD2
17+
handleClient KEYWORD2
18+
on KEYWORD2
19+
uri KEYWORD2
20+
method KEYWORD2
21+
client KEYWORD2
22+
send KEYWORD2
23+
arg KEYWORD2
24+
25+
#######################################
26+
# Constants (LITERAL1)
27+
#######################################
28+
29+
HTTP_GET LITERAL1
30+
HTTP_POST LITERAL1
31+
HTTP_ANY LITERAL1

0 commit comments

Comments
 (0)