#include <SPI.h>
#include <Ethernet.h>
#include <Dns.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
// this check is only needed on the Leonardo:
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// print your local IP address:
Serial.print("IP: ");
Serial.println(Ethernet.localIP());
Serial.print("Gateway: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("Subnet: ");
Serial.println(Ethernet.subnetMask());
Serial.print("DNS: ");
Serial.println(Ethernet.dnsServerIP());
Serial.println();
}
void loop() {
}