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
//#include <enc28j60.h>
#include <EtherCard.h>
//#include <net.h>
 
  static byte mymac[] =  { 0x74,0x69,0x69,0x2D,0x30,0x31 };
  byte Ethernet::buffer[700];
 
void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
 
 if (ether.begin(sizeof Ethernet::buffer, mymac) == 0
    Serial.println(F("Failed to access Ethernet controller"));
 
  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() {
  // put your main code here, to run repeatedly:
 
}
cs


PIN Connections (Using Arduino UNO):

VCC -   3.3V
GND -    GND
SCK - Pin 13
SO  - Pin 12
SI  - Pin 11
CS  - Pin  8 # Selectable with the ether.begin() function




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  const char website[] PROGMEM = "www.google.com";
  static byte hisip[] = {내 ip};
  static uint32_t timer;
 
 
void setup() {
 
  ether.hisport = 8080;
  ether.copyIp(ether.hisip, hisip);
}
 
void loop() {
  // put your main code here, to run repeatedly:
   if (millis() > timer) {
   timer = millis() + 5000;
    Serial.println();
    Serial.print("<<< REQ ");
  ether.packetLoop(ether.packetReceive());
  ether.browseUrl(PSTR("/Spring_Hello/"), "hello.do""내 ip"NULL);
  delay(1000);
}}
cs


+ Recent posts