Skip to content

Commit

Permalink
And let it blink!
Browse files Browse the repository at this point in the history
  • Loading branch information
funnybrum committed Feb 11, 2020
1 parent 2c69090 commit c42db19
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ void WebServer::registerHandlers() {
server->on("/settings", std::bind(&WebServer::handle_settings, this));
server->on("/get", std::bind(&WebServer::handle_get, this));
server->on("/stats", std::bind(&WebServer::handle_stats, this));
server->on("/calibrate", std::bind(&WebServer::handle_calibrate, this));
server->on("/calibrate", std::bind(&WebServer::handle_calibrate, this));
server->on("/blink", std::bind(&WebServer::handle_blink, this));

}

void WebServer::handle_root() {
Expand Down Expand Up @@ -76,4 +78,13 @@ void WebServer::handle_stats() {
void WebServer::handle_calibrate() {
bool result = co2.calibrate();
server->send(200, "text/plain", result?"Done":"Failed");
}
}

void WebServer::handle_blink() {
pinMode(12, OUTPUT);
digitalWrite(12, LOW);
delay(250);
digitalWrite(12, HIGH);
pinMode(12, INPUT);
server->send(200, "text/plain", "Done");
}
1 change: 1 addition & 0 deletions src/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class WebServer: public WebServerBase {
void handle_get();
void handle_settings();
void handle_calibrate();
void handle_blink();
};

0 comments on commit c42db19

Please sign in to comment.