1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| #include <SPI.h>
#include <Ethernet.h>
#include <utility/w5100.h>
byte mac[] = { 0x80, 0xA2, 0xDA, 0x01, 0x59, 0x66 };
byte ip[] = { 192, 168, 0, 7 };
byte gateway[] = { 192, 168, 0, 157 };
byte subnet[] = { 255, 255, 255, 0 };
byte ipBuf[4];
char outBuf[18];
void setup()
{
Serial.begin(9600);
pinMode(53,OUTPUT);
digitalWrite(53,1);
//Ethernet.begin(mac, ip, gateway, subnet);
W5100.setIPAddress(ip);
W5100.setSubnetMask(subnet);
W5100.setGatewayIp(gateway);
W5100.setMACAddress(mac);
W5100.getIPAddress(ipBuf);
//sprintf(outBuf,"%u.%u.%u.%u\r\n",ipBuf[0],ipBuf[1],ipBuf[2],ipBuf[3]);
//Serial.println(Ethernet.localIP());
//Serial.println(outBuf);
Ethernet.begin(mac, ip, gateway, subnet);
delay(1000);
}
void loop()
{
Serial.println("Tick");
delay(1000);
} |