|
|
这个教程关于EtherCard
源代码地址
在arduino1.6.1环境下编译不过
错误提示web1.ino:4:16: error: variable 'website' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
以下是代码
#include <EtherCard.h>
static byte mymac[] = { 0x78, 0x2B, 0xCB, 0xDC, 0x99, 0x15 };
char website[] PROGMEM =("www.lucadentella.it");就是这行代码编译不过。
byte Ethernet::buffer[700];
static uint32_t timer;
static void response_callback(byte status, word off, word len) {
Serial.print((const char*)Ethernet::buffer + off + 207);
}
void setup() {
Serial.begin(57600);
Serial.println("Client Demo");
Serial.println();
if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
Serial.println("Failed to access Ethernet controller");
else
Serial.println("Ethernet controller initialized");
Serial.println();
if (!ether.dhcpSetup())
Serial.println("Failed to get configuration from DHCP");
else
Serial.println("DHCP configuration done");
ether.printIp("IP Address:\t", ether.myip);
ether.printIp("Netmask:\t", ether.netmask);
ether.printIp("Gateway:\t", ether.gwip);
Serial.println();
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
else
Serial.println("DNS resolution done");
ether.printIp("SRV IP:\t", ether.hisip);
Serial.println();
}
void loop() {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
ether.browseUrl(PSTR("/demo/"), "aphorisms.php", website, response_callback);
}
}
希望大家可以帮忙看下,多谢了
|
|