daily_automated
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include <Ethernet.h>
|
||||
|
||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
||||
byte ip[] = { 192, 168, 1, 177 };
|
||||
|
||||
Server server(80);
|
||||
|
||||
void setup() {
|
||||
Ethernet.begin(mac, ip);
|
||||
server.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Client client = server.available();
|
||||
if (client) {
|
||||
boolean current_line_is_blank = true;
|
||||
while (client.connected()) {
|
||||
if (client.available()) {
|
||||
char c = client.read();
|
||||
if (c == '\n' && current_line_is_blank) {
|
||||
client.println("HTTP/1.1 200 OK");
|
||||
client.println("Content-Type: text/html");
|
||||
client.println();
|
||||
|
||||
client.print("Analog input 0 = <b>");
|
||||
client.print(analogRead(0));
|
||||
client.println("</b><br>");
|
||||
client.print("millis() = <b>");
|
||||
client.println(millis());
|
||||
client.println("</b><br>");
|
||||
break;
|
||||
}
|
||||
if (c == '\n') {
|
||||
current_line_is_blank = true;
|
||||
} else if (c != '\r') {
|
||||
current_line_is_blank = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
delay(1);
|
||||
client.stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user