daily_automated
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// Arduino demo sketch for testing the DHCP client code
|
||||
//
|
||||
// Original author: Andrew Lindsay
|
||||
// Major rewrite and API overhaul by jcw, 2011-06-07
|
||||
//
|
||||
// License: GPLv2
|
||||
|
||||
#include <EtherCard.h>
|
||||
|
||||
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
|
||||
|
||||
byte Ethernet::buffer[700];
|
||||
|
||||
void setup () {
|
||||
Serial.begin(57600);
|
||||
Serial.println(F("\n[testDHCP]"));
|
||||
|
||||
Serial.print("MAC: ");
|
||||
for (byte i = 0; i < 6; ++i) {
|
||||
Serial.print(mymac[i], HEX);
|
||||
if (i < 5)
|
||||
Serial.print(':');
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
// Change 'SS' to your Slave Select pin, if you arn't using the default pin
|
||||
if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
|
||||
Serial.println(F("Failed to access Ethernet controller"));
|
||||
|
||||
Serial.println(F("Setting up DHCP"));
|
||||
if (!ether.dhcpSetup())
|
||||
Serial.println(F("DHCP failed"));
|
||||
|
||||
ether.printIp("My IP: ", ether.myip);
|
||||
ether.printIp("Netmask: ", ether.netmask);
|
||||
ether.printIp("GW IP: ", ether.gwip);
|
||||
ether.printIp("DNS IP: ", ether.dnsip);
|
||||
}
|
||||
|
||||
void loop () {
|
||||
ether.packetLoop(ether.packetReceive());
|
||||
}
|
||||
Reference in New Issue
Block a user