Hola, hace dias me regalaron el shield ENC28J60, sobre tolo lo que investigue no pude encontrar mucha informacion. copiando los codigos de diferentes foros y tutoriales, algunos funcionan y otros no. El ultimo sketch que probe fue para encender y apagar un led mediante la libreria EtherCard. El problema que tengo es que la parte de configurar e iniciar la shield lo entiendo, lo uso con el Arduino MEGA. lo que no entiendo es la parte de crear la pagina web por HTML. Si me pudieran explicar un poco la funcion de cada comando de la libreria o si tienen otra libreria para poder usar con esta shield y el arduino MEGA se los agradeceria.
#include <EtherCard.h>
static byte mymac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x31 }; //DIRECCION MAC
static byte myip[] = { 192, 168, 1, 155 }; //IP A LA QUE NOS CONECTAREMOSbyte Ethernet::buffer[500]; //TAMAÑO DEL BUFFER -> 500
BufferFiller bfill; //DECLARAMOS EL BUFFER COMO "BFILL"void setup () {
ether.begin(sizeof Ethernet::buffer, mymac, 53); //INICIAMOS CON BUFFER:500, MAC, PIN CS: 53
ether.staticSetup(myip); //INICIAMOS LA IP
}void loop () {
word pos = ether.packetLoop(ether.packetReceive());
if (pos) //SI LA INFORMACION ES VALIDA
ether.httpServerReply(homePage()); //ENVIA LOS DATOS DE LA PAGINA WEB
}static word homePage() {
bfill = ether.tcpOffset();
bfill.emit_p(PSTR(
""
""
"TITULO DE LA PAGINA"
""
""
"Hello World!
"
""
""));
return bfill.position();
}