9
9
#include " ZephyrClient.h"
10
10
#include " ZephyrEthernet.h"
11
11
12
+ // Enter a MAC address and IP address for your controller below.
12
13
// The IP address will be dependent on your local network:
14
+ byte mac[] = {
15
+ 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED
16
+ };
17
+
13
18
IPAddress ip (192 , 168 , 1 , 177 );
14
19
15
20
// Initialize the Ethernet server library
@@ -33,7 +38,7 @@ void setup() {
33
38
}
34
39
35
40
// start the Ethernet connection and the server:
36
- Ethernet.begin (ip);
41
+ Ethernet.begin (mac, ip);
37
42
38
43
// Check for Ethernet hardware present
39
44
if (Ethernet.hardwareStatus () == EthernetNoHardware) {
@@ -58,17 +63,17 @@ void loop() {
58
63
ZephyrClient client = server.accept ();
59
64
if (client) {
60
65
Serial.println (" new client" );
61
- // an http request ends with a blank line
62
- boolean currentLineIsBlank = true ;
66
+ // an HTTP request ends with a blank line
67
+ bool currentLineIsBlank = true ;
63
68
while (client.connected ()) {
64
69
if (client.available ()) {
65
70
char c = client.read ();
66
71
Serial.write (c);
67
72
// if you've gotten to the end of the line (received a newline
68
- // character) and the line is blank, the http request has ended,
73
+ // character) and the line is blank, the HTTP request has ended,
69
74
// so you can send a reply
70
75
if (c == ' \n ' && currentLineIsBlank) {
71
- // send a standard http response header
76
+ // send a standard HTTP response header
72
77
client.println (" HTTP/1.1 200 OK" );
73
78
client.println (" Content-Type: text/html" );
74
79
client.println (" Connection: close" ); // the connection will be closed after completion of the response
@@ -103,5 +108,4 @@ void loop() {
103
108
client.stop ();
104
109
Serial.println (" client disconnected" );
105
110
}
106
- }
107
-
111
+ }
0 commit comments