Skip to content
Permalink
Browse files

Generate Arduino web project

  • Loading branch information...
lasselukkari committed Mar 19, 2019
1 parent 68190bf commit 1091a2e9020099faa8c93ca69daf8b749eb250c3
Showing with 1,782 additions and 0 deletions.
  1. +31 −0 BlinkServer/BlinkServer.ino
  2. +21 −0 BlinkServer/StaticFiles.ino
  3. +1,461 −0 BlinkServer/aWOT.cpp
  4. +269 −0 BlinkServer/aWOT.h
@@ -0,0 +1,31 @@
#include <WiFi.h>
#include "aWOT.h"

#define WIFI_SSID "network"
#define WIFI_PASSWORD "password"

WiFiServer server(80);
Application app;

void setup() {
Serial.begin(115200);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.localIP());

app.route(staticFiles());

server.begin();
}

void loop() {
WiFiClient client = server.available();

if (client.connected()) {
app.process(&client);
}
}
@@ -0,0 +1,21 @@
void static_index(Request &req, Response &res) {
P(index) =
"<html>\n"
"<head>\n"
"<title>Hello World!</title>\n"
"</head>\n"
"<body>\n"
"<h1>Greetings middle earth!</h1>\n"
"</body>\n"
"</html>";

res.set("Content-Type", "text/html");
res.printP(index);
}

Router staticFileRouter("/");

Router * staticFiles() {
staticFileRouter.get("", &static_index);
return &staticFileRouter;
}
Oops, something went wrong.

0 comments on commit 1091a2e

Please sign in to comment.
You can’t perform that action at this time.