Skip to content

Commit 99f5032

Browse files
committed
examples/tests update
1 parent eeb6c7b commit 99f5032

File tree

4 files changed

+17
-29
lines changed

4 files changed

+17
-29
lines changed

examples/EthernetAdvancedChatServer/EthernetAdvancedChatServer.ino

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,30 @@
99

1010
#include <Ethernet.h>
1111

12-
// Enter a MAC address and IP address for your controller below.
13-
// The IP address will be dependent on your local network.
14-
// gateway and subnet are optional:
1512
byte mac[] = {
1613
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
1714
};
1815

19-
// telnet defaults to port 23
20-
EthernetServer server(23);
16+
EthernetServer server(2323);
2117

2218
EthernetClient clients[8];
2319

2420
void setup() {
2521

26-
// initialize the Ethernet device
27-
Ethernet.init(10);
28-
Ethernet.begin(mac);
29-
30-
// Open serial communications and wait for port to open:
3122
Serial.begin(115200);
32-
while (!Serial) {
33-
; // wait for serial port to connect. Needed for native USB port only
34-
}
23+
while (!Serial);
3524

36-
// Check for Ethernet hardware present
37-
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
38-
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
39-
while (true) {
40-
delay(1); // do nothing, no point running without Ethernet hardware
41-
}
42-
}
43-
if (Ethernet.linkStatus() == LinkOFF) {
44-
Serial.println("Ethernet cable is not connected.");
45-
}
25+
// Ethernet.init(10);
26+
Ethernet.begin(mac);
4627

4728
// start listening for clients
4829
server.begin();
4930

50-
Serial.print("Chat server address:");
51-
Serial.println(Ethernet.localIP());
31+
IPAddress ip = Ethernet.localIP();
32+
Serial.println();
33+
Serial.print("To access the server, connect with Telnet client to ");
34+
Serial.print(ip);
35+
Serial.println(" 2323");
5236
}
5337

5438
void loop() {

examples/EthernetPagerServer/EthernetPagerServer.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void setup() {
3030
Serial.begin(115200);
3131
while (!Serial);
3232

33+
// Ethernet.init(10);
3334
Ethernet.begin(mac);
3435

3536
server.begin();

examples/LegacyEthernetTest/LegacyEthernetTest.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void setup() {
1414
Serial.println();
1515

1616
// Ethernet.init(10);
17-
// Ethernet.begin(mac, INADDR_NONE); // force hw init for some libraries
17+
// Ethernet.begin(mac, IPAddress(182, 168, 0, 177)); // force hw init for some libraries
1818

1919
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
2020
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");

examples/WiFiTest/WiFiTest.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ void setup() {
4848
Serial.print("Resolve IP for ");
4949
Serial.println(serverName);
5050
IPAddress resolvedIP;
51-
WiFi.hostByName("www.google.com", resolvedIP);
52-
Serial.print("\t");
53-
Serial.println(resolvedIP);
51+
if (WiFi.hostByName("www.google.com", resolvedIP) == 1) {
52+
Serial.print("\t");
53+
Serial.println(resolvedIP);
54+
} else {
55+
Serial.println("\t...ERROR");
56+
}
5457
Serial.println();
5558

5659
WiFi.disconnect();

0 commit comments

Comments
 (0)