2323#include < SPI.h>
2424#include < Ethernet.h>
2525
26+ #define ON_TAYLOR_WORK_PC
27+ // #define DEBUG_DHCPCHATSERVER_INO_SETUP
28+
2629// Enter a MAC address and IP address for your controller below.
2730// The IP address will be dependent on your local network.
2831// gateway and subnet are optional:
32+ #ifdef ON_TAYLOR_WORK_PC
33+ byte mac[] = {
34+ 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED };
35+ IPAddress ip (192 , 168 , 0 , 3 );
36+ IPAddress myDns (192 , 168 , 0 , 1 );
37+ IPAddress gateway (192 , 168 , 0 , 1 );
38+ IPAddress subnet (255 , 255 , 0 , 0 );
39+ #else
2940byte mac[] = {
3041 0x00 , 0xAA , 0xBB , 0xCC , 0xDE , 0x02
3142};
3243IPAddress ip (192 , 168 , 1 , 177 );
3344IPAddress myDns (192 , 168 , 1 , 1 );
3445IPAddress gateway (192 , 168 , 1 , 1 );
3546IPAddress subnet (255 , 255 , 0 , 0 );
47+ #endif
3648
3749// telnet defaults to port 23
3850EthernetServer server (23 );
@@ -55,7 +67,14 @@ void setup() {
5567
5668 // start the Ethernet connection:
5769 Serial.println (" Trying to get an IP address using DHCP" );
70+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
71+ PRINTSTR (" Ethernet.begin(mac)" );
72+ #endif
5873 if (Ethernet.begin (mac) == 0 ) {
74+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
75+ PRINTSTR (" Ethernet.begin(mac) == 0" );
76+ #endif
77+
5978 Serial.println (" Failed to configure Ethernet using DHCP" );
6079 // Check for Ethernet hardware present
6180 if (Ethernet.hardwareStatus () == EthernetNoHardware) {
@@ -70,6 +89,11 @@ void setup() {
7089 // initialize the Ethernet device not using DHCP:
7190 Ethernet.begin (mac, ip, myDns, gateway, subnet);
7291 }
92+
93+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
94+ PRINTLINE ();
95+ #endif
96+
7397 // print your local IP address:
7498 Serial.print (" My IP address: " );
7599 Serial.println (Ethernet.localIP ());
0 commit comments