提供したコードで確認してください。 Jean-Claude WipperのGithubページで提供されているスケッチと同じです。それ以外の場合、私は常に Chip Select Pin を " ether.begin "機能に提供しなければなりません。そうしないとENC28J60が応答しません。
// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 http://opensource.org/licenses/mit-license.php
// Connection Diagram: http://i.stack.imgur.com/SvG7J.jpg
#include
#define STATIC 1 //set to 1 to disable DHCP (adjust myip/gwip values below)
#define CS_PIN 10
#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,200 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#endif
// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[500];//tcp/ip send and receive buffer
const char page[] PROGMEM =
"HTTP/1.0 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
"<html>"
"<head><title>"
"Service Temporarily Unavailable"
"</title></head>"
"<body>"
"This service is currently unavailable
"
""
"The main server is currently off-line.
"
"Please try again later."
"
"
"</body>"
"</html>"
;
void setup(){
Serial.begin(9600);
Serial.println("\n[backSoon]");
if (ether.begin(sizeof Ethernet::buffer, mymac, CS_PIN) == 0)
Serial.println( "Failed to access Ethernet controller");
#if STATIC
ether.staticSetup(myip, gwip);
#else
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
#endif
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
}
void loop(){
//wait for an incoming TCP packet, but ignore its contents
if (ether.packetLoop(ether.packetReceive())) {
memcpy_P(ether.tcpOffset(), page, sizeof page);
ether.httpServerReply(sizeof page - 1);
}
}
ダウンロード: Arduino EtherCardライブラリ
Essential Task
Before uploading your sketch, you first need to connect your ENC28J60 module to your PC using LAN cable or you can also connect to your router. Now the main part comes. The variable "gwip" must match with your gateway IP address.
If you have connected with your PC, find your PC > Ethernet's IP address which may be look like "169.254.x.x":

If you have connected to your router, place router's IP in "gwip".
ゲートウェイIPを取得したら、それを "gwip"変数に書き込み、スケッチをアップロードします。