Im using the EtherCard library. I need to build a small webserver to show some data, arduino received via serial interface.
I could run this example sketch:
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x00,0x14,0xA5,0x76,0x19,0x3A };
static byte myip[] = { 192,168,1,7 };
byte Ethernet::buffer[500]; //??????
BufferFiller bfill; //???????
void setup () {
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
ether.staticSetup(myip);
}
static word homePage() {
long t = millis() / 1000;
word h = t / 3600;
byte m = (t / 60) % 60;
byte s = t % 60;
bfill = ether.tcpOffset(); //???????
bfill.emit_p(PSTR( //???????
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\n"
"Pragma: no-cache\r\n"
"\r\n"
"<meta http-equiv='refresh' content='1'/>"
"<title>RBBB server</title>"
"<h1>$D$D:$D$D:$D$D</h1>"),
h/10, h%10, m/10, m%10, s/10, s%10); //???????
return bfill.position(); //???????
}
void loop () {
word len = ether.packetReceive();
word pos = ether.packetLoop(len);
if (pos) // check if valid tcp data is received
ether.httpServerReply(homePage()); // send web page data
}
Now I need to modify this to achieve my task, so please help me to understand the codes I marked with ??? above…
Thanx…