23
23
#include < SPI.h>
24
24
#include < Ethernet.h>
25
25
26
+ #define ON_TAYLOR_WORK_PC
27
+ // #define DEBUG_DHCPCHATSERVER_INO_SETUP
28
+
26
29
// Enter a MAC address and IP address for your controller below.
27
30
// The IP address will be dependent on your local network.
28
31
// 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
29
40
byte mac[] = {
30
41
0x00 , 0xAA , 0xBB , 0xCC , 0xDE , 0x02
31
42
};
32
43
IPAddress ip (192 , 168 , 1 , 177 );
33
44
IPAddress myDns (192 , 168 , 1 , 1 );
34
45
IPAddress gateway (192 , 168 , 1 , 1 );
35
46
IPAddress subnet (255 , 255 , 0 , 0 );
47
+ #endif
36
48
37
49
// telnet defaults to port 23
38
50
EthernetServer server (23 );
@@ -55,7 +67,14 @@ void setup() {
55
67
56
68
// start the Ethernet connection:
57
69
Serial.println (" Trying to get an IP address using DHCP" );
70
+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
71
+ PRINTSTR (" Ethernet.begin(mac)" );
72
+ #endif
58
73
if (Ethernet.begin (mac) == 0 ) {
74
+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
75
+ PRINTSTR (" Ethernet.begin(mac) == 0" );
76
+ #endif
77
+
59
78
Serial.println (" Failed to configure Ethernet using DHCP" );
60
79
// Check for Ethernet hardware present
61
80
if (Ethernet.hardwareStatus () == EthernetNoHardware) {
@@ -70,6 +89,11 @@ void setup() {
70
89
// initialize the Ethernet device not using DHCP:
71
90
Ethernet.begin (mac, ip, myDns, gateway, subnet);
72
91
}
92
+
93
+ #if defined DEBUG_DHCPCHATSERVER_INO_SETUP
94
+ PRINTLINE ();
95
+ #endif
96
+
73
97
// print your local IP address:
74
98
Serial.print (" My IP address: " );
75
99
Serial.println (Ethernet.localIP ());
0 commit comments