Update Garage_Nano.ino
This commit is contained in:
+5
-15
@@ -63,6 +63,9 @@ void loop() {
|
|||||||
while (client.connected()) {
|
while (client.connected()) {
|
||||||
if (client.available()) {
|
if (client.available()) {
|
||||||
char c = client.read();
|
char c = client.read();
|
||||||
|
|
||||||
|
// TODO extract GET URI
|
||||||
|
|
||||||
Serial.write(c);
|
Serial.write(c);
|
||||||
// if you've gotten to the end of the line (received a newline
|
// if you've gotten to the end of the line (received a newline
|
||||||
// character) and the line is blank, the http request has ended,
|
// character) and the line is blank, the http request has ended,
|
||||||
@@ -70,22 +73,10 @@ void loop() {
|
|||||||
if (c == '\n' && currentLineIsBlank) {
|
if (c == '\n' && currentLineIsBlank) {
|
||||||
// send a standard http response header
|
// send a standard http response header
|
||||||
client.println("HTTP/1.1 200 OK");
|
client.println("HTTP/1.1 200 OK");
|
||||||
client.println("Content-Type: text/html");
|
client.println("Content-Type: text/plain");
|
||||||
client.println("Connection: close"); // the connection will be closed after completion of the response
|
client.println("Connection: close"); // the connection will be closed after completion of the response
|
||||||
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
|
|
||||||
client.println();
|
client.println();
|
||||||
client.println("<!DOCTYPE HTML>");
|
client.println("Mufflon!");
|
||||||
client.println("<html>");
|
|
||||||
// output the value of each analog input pin
|
|
||||||
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
|
|
||||||
int sensorReading = analogRead(analogChannel);
|
|
||||||
client.print("analog input ");
|
|
||||||
client.print(analogChannel);
|
|
||||||
client.print(" is ");
|
|
||||||
client.print(sensorReading);
|
|
||||||
client.println("<br />");
|
|
||||||
}
|
|
||||||
client.println("</html>");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
@@ -130,4 +121,3 @@ void triggerAll() {
|
|||||||
digitalWrite(motorPin, LOW);
|
digitalWrite(motorPin, LOW);
|
||||||
digitalWrite(ledPin, HIGH);
|
digitalWrite(ledPin, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user