28j60用ethercard库,示例都无法完成。求助!
本帖最后由 坤遠遊森林 于 2012-9-28 15:27 编辑// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08 <[email protected]> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer;
static uint32_t timer;
char website[] PROGMEM = "www.google.com";
// called when the client request is complete
static void my_callback (byte status, word off, word len) {
Serial.println(">>>");
Ethernet::buffer = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println("\n");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
ether.printIp("IP:", ether.myip);
ether.printIp("GW:", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/foo/"), "bar", website, my_callback);
}
}
跑webclient这个示例。下载到板上,28j60的两个灯都不亮。
串口监视是这样的。。求助啊!!
我也一直很郁闷 请详细说接线和arduino种类,这个库绝没问题的 亲~!请修改您的波特率~!:lol:P
页:
[1]