99#include " ZephyrClient.h"
1010#include " ZephyrEthernet.h"
1111
12+ // Enter a MAC address and IP address for your controller below.
1213// The IP address will be dependent on your local network:
14+ byte mac[] = {
15+ 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED
16+ };
17+
1318IPAddress ip (192 , 168 , 1 , 177 );
1419
1520// Initialize the Ethernet server library
@@ -33,7 +38,7 @@ void setup() {
3338 }
3439
3540 // start the Ethernet connection and the server:
36- Ethernet.begin (ip);
41+ Ethernet.begin (mac, ip);
3742
3843 // Check for Ethernet hardware present
3944 if (Ethernet.hardwareStatus () == EthernetNoHardware) {
@@ -58,17 +63,17 @@ void loop() {
5863 ZephyrClient client = server.accept ();
5964 if (client) {
6065 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 ;
6368 while (client.connected ()) {
6469 if (client.available ()) {
6570 char c = client.read ();
6671 Serial.write (c);
6772 // 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,
6974 // so you can send a reply
7075 if (c == ' \n ' && currentLineIsBlank) {
71- // send a standard http response header
76+ // send a standard HTTP response header
7277 client.println (" HTTP/1.1 200 OK" );
7378 client.println (" Content-Type: text/html" );
7479 client.println (" Connection: close" ); // the connection will be closed after completion of the response
@@ -103,5 +108,4 @@ void loop() {
103108 client.stop ();
104109 Serial.println (" client disconnected" );
105110 }
106- }
107-
111+ }
0 commit comments