Skip to content

Commit 4e87244

Browse files
authored
W6100 IPv4 (#6)
The W6100 IPv4 Arduino Example.(For W6100 Ethernet Shield)
1 parent 3e66daf commit 4e87244

File tree

19 files changed

+1331
-94
lines changed

19 files changed

+1331
-94
lines changed

examples/AdvancedChatServer/AdvancedChatServer.ino

+9
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,25 @@
2222
#include <SPI.h>
2323
#include <Ethernet.h>
2424

25+
#define ON_TAYLOR_WORK_PC
26+
2527
// Enter a MAC address and IP address for your controller below.
2628
// The IP address will be dependent on your local network.
2729
// gateway and subnet are optional:
2830
byte mac[] = {
2931
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
3032
};
33+
#if defined ON_TAYLOR_WORK_PC
34+
IPAddress ip(192, 168, 0, 3);
35+
IPAddress myDns(192, 168, 0, 1);
36+
IPAddress gateway(192, 168, 0, 1);
37+
IPAddress subnet(255, 255, 0, 0);
38+
#else
3139
IPAddress ip(192, 168, 1, 177);
3240
IPAddress myDns(192, 168, 1, 1);
3341
IPAddress gateway(192, 168, 1, 1);
3442
IPAddress subnet(255, 255, 0, 0);
43+
#endif
3544

3645

3746
// telnet defaults to port 23

examples/BarometricPressureWebServer/BarometricPressureWebServer.ino

+6
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@
2727
// the sensor communicates using SPI, so include the library:
2828
#include <SPI.h>
2929

30+
#define ON_TAYLOR_WORK_PC
3031

3132
// assign a MAC address for the Ethernet controller.
3233
// fill in your address here:
3334
byte mac[] = {
3435
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
3536
};
37+
#if defined ON_TAYLOR_WORK_PC
38+
IPAddress ip(192, 168, 0, 3);
39+
#else
3640
// assign an IP address for the controller:
3741
IPAddress ip(192, 168, 1, 20);
42+
#endif
43+
3844

3945

4046
// Initialize the Ethernet server library

examples/ChatServer/ChatServer.ino

+12-1
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,27 @@
1919
#include <SPI.h>
2020
#include <Ethernet.h>
2121

22+
#define ON_TAYLOR_WORK_PC
23+
//#define DEBUG_CHATSERVER_INO_ETHERNET_BEGIN
24+
2225
// Enter a MAC address and IP address for your controller below.
2326
// The IP address will be dependent on your local network.
2427
// gateway and subnet are optional:
28+
#if defined ON_TAYLOR_WORK_PC
29+
byte mac[] = {
30+
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
31+
IPAddress ip(192, 168, 0, 3);
32+
IPAddress myDns(192, 168, 0, 1);
33+
IPAddress gateway(192, 168, 0, 1);
34+
IPAddress subnet(255, 255, 0, 0);
35+
#else
2536
byte mac[] = {
2637
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
2738
IPAddress ip(192, 168, 1, 177);
2839
IPAddress myDns(192, 168, 1, 1);
2940
IPAddress gateway(192, 168, 1, 1);
3041
IPAddress subnet(255, 255, 0, 0);
31-
42+
#endif
3243

3344
// telnet defaults to port 23
3445
EthernetServer server(23);

examples/DhcpChatServer/DhcpChatServer.ino

+24
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,28 @@
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
2940
byte mac[] = {
3041
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
3142
};
3243
IPAddress ip(192, 168, 1, 177);
3344
IPAddress myDns(192, 168, 1, 1);
3445
IPAddress gateway(192, 168, 1, 1);
3546
IPAddress subnet(255, 255, 0, 0);
47+
#endif
3648

3749
// telnet defaults to port 23
3850
EthernetServer 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());

examples/TelnetClient/TelnetClient.ino

+9
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,24 @@
2020
#include <SPI.h>
2121
#include <Ethernet.h>
2222

23+
#define ON_TAYLOR_WORK_PC
24+
2325
// Enter a MAC address and IP address for your controller below.
2426
// The IP address will be dependent on your local network:
2527
byte mac[] = {
2628
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
2729
};
30+
#if defined ON_TAYLOR_WORK_PC
31+
IPAddress ip(192, 168, 0, 3);
32+
33+
// Enter the IP address of the server you're connecting to:
34+
IPAddress server(192, 168, 0, 2);
35+
#else
2836
IPAddress ip(192, 168, 1, 177);
2937

3038
// Enter the IP address of the server you're connecting to:
3139
IPAddress server(1, 1, 1, 1);
40+
#endif
3241

3342
// Initialize the Ethernet client library
3443
// with the IP address and port of the server

examples/UDPSendReceiveString/UDPSendReceiveString.ino

+9
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@
1616
#include <Ethernet.h>
1717
#include <EthernetUdp.h>
1818

19+
#define ON_TAYLOR_WORK_PC
20+
1921
// Enter a MAC address and IP address for your controller below.
2022
// The IP address will be dependent on your local network:
2123
byte mac[] = {
2224
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
2325
};
26+
#if defined ON_TAYLOR_WORK_PC
27+
IPAddress ip(192, 168, 0, 3);
28+
#else
2429
IPAddress ip(192, 168, 1, 177);
30+
#endif
2531

2632
unsigned int localPort = 8888; // local port to listen on
2733

@@ -63,6 +69,9 @@ void setup() {
6369

6470
// start UDP
6571
Udp.begin(localPort);
72+
73+
Serial.print("Udp server address:");
74+
Serial.println(Ethernet.localIP());
6675
}
6776

6877
void loop() {

examples/UdpNtpClient/UdpNtpClient.ino

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#include <Ethernet.h>
2323
#include <EthernetUdp.h>
2424

25+
#define TIMESERVER 2
26+
//#define DEBUG_UDPNTPCLIENT_INO_SENDNTPPACKET
27+
2528
// Enter a MAC address for your controller below.
2629
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
2730
byte mac[] = {
@@ -30,7 +33,11 @@ byte mac[] = {
3033

3134
unsigned int localPort = 8888; // local port to listen for UDP packets
3235

36+
#if TIMESERVER == 1
3337
const char timeServer[] = "time.nist.gov"; // time.nist.gov NTP server
38+
#elif TIMESERVER == 2
39+
const char timeServer[] = "time.bora.net"; // time.bora.net NTP server
40+
#endif
3441

3542
const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
3643

@@ -124,6 +131,11 @@ void loop() {
124131

125132
// send an NTP request to the time server at the given address
126133
void sendNTPpacket(const char * address) {
134+
135+
#if defined DEBUG_UDPNTPCLIENT_INO_SENDNTPPACKET
136+
PRINTLINE();
137+
#endif
138+
127139
// set all bytes in the buffer to 0
128140
memset(packetBuffer, 0, NTP_PACKET_SIZE);
129141
// Initialize values needed to form NTP request

examples/WebClient/WebClient.ino

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <SPI.h>
1818
#include <Ethernet.h>
1919

20+
#define ON_TAYLOR_WORK_PC
21+
2022
// Enter a MAC address for your controller below.
2123
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
2224
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
@@ -27,7 +29,11 @@ byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
2729
char server[] = "www.google.com"; // name address for Google (using DNS)
2830

2931
// Set the static IP address to use if the DHCP fails to assign
32+
#if defined ON_TAYLOR_WORK_PC
33+
IPAddress ip(192, 168, 0, 3);
34+
#else
3035
IPAddress ip(192, 168, 0, 177);
36+
#endif
3137
IPAddress myDns(192, 168, 0, 1);
3238

3339
// Initialize the Ethernet client library

examples/WebClientRepeating/WebClientRepeating.ino

+6
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@
2525
#include <SPI.h>
2626
#include <Ethernet.h>
2727

28+
#define ON_TAYLOR_WORK_PC
29+
2830
// assign a MAC address for the ethernet controller.
2931
// fill in your address here:
3032
byte mac[] = {
3133
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
3234
};
3335
// Set the static IP address to use if the DHCP fails to assign
36+
#if defined ON_TAYLOR_WORK_PC
37+
IPAddress ip(192, 168, 0, 3);
38+
#else
3439
IPAddress ip(192, 168, 0, 177);
40+
#endif
3541
IPAddress myDns(192, 168, 0, 1);
3642

3743
// initialize the library instance:

examples/WebServer/WebServer.ino

+6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
#include <SPI.h>
2121
#include <Ethernet.h>
2222

23+
#define ON_TAYLOR_WORK_PC
24+
2325
// Enter a MAC address and IP address for your controller below.
2426
// The IP address will be dependent on your local network:
2527
byte mac[] = {
2628
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
2729
};
30+
#if defined ON_TAYLOR_WORK_PC
31+
IPAddress ip(192, 168, 0, 3);
32+
#else
2833
IPAddress ip(192, 168, 1, 177);
34+
#endif
2935

3036
// Initialize the Ethernet server library
3137
// with the IP address and port you want to use

keywords.txt

+1
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ EthernetW5100 LITERAL1
6666
EthernetW5200 LITERAL1
6767
EthernetW5500 LITERAL1
6868
EthernetW5100S LITERAL1
69+
EthernetW6100 LITERAL1

0 commit comments

Comments
 (0)