LIBRERIA ENC28J60

ciao a tutti ho preso da un sito questa libreria per ethernet enc28j60, ma quando la carico mi dice: errore di compilazione. ma non mi sottolinea niente.
GRAZIE

/*
 * Web Server
 *
 * A simple web server that shows the value of the analog input pins.
 */

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 123 };

EthernetServer server(80);

void setup()
{
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  EthernetClient client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          // output the value of each analog input pin
          for (int i = 0; i < 6; i++) {
            client.print("analog input ");
            client.print(i);
            client.print(" is ");
            client.print(analogRead(i));
            client.println("
");
          }
          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    client.stop();
  }
}

Il codice si racchiude tra gli appositi tag: ho modificato il tuo msg.

samukid:
ciao a tutti ho preso da un sito questa libreria per ethernet enc28j60

Quale?

http://areacom.altervista.org/Enc28j60:_colleghiamo_Arduino_in_rete_come_web_server/page/113

Leggi qui che è meglio:

samukid:
http://areacom.altervista.org/Enc28j60:_colleghiamo_Arduino_in_rete_come_web_server/page/113

Sul sito

#include <EtherCard.h>

nel tuo sketch

#include <Ethernet.h>

ok, ho provato a cambiare,ma mi sottolinea questa riga
EthernetServer server(80);
il punto e che non mi accetta neanche le librerie scaricate da internet inerenti al enc28j60.
non so piu cosa fare?
Qualcuno ha avuto il mio problema?

Non puoi usare gli esempi dell'IDE per l'ENC. Quel micro non è ufficialmente supportato.
Devi scaricarti la libreria indicata, inserirla correttamente nell'IDE e usare gli esempi inclusi nella libreria.
I comandi e le funzioni delle due librerie, per WIZ5100 (supportata) e per ENC, sono diversi.

Sì lo so, il punto è che non mi accetta quelli scaricate appositamente per l'enc.
Potrebbe essere un problema riguardante all' ide o alle librerie che non sono state aggiornate per la versione 1.0.5??

L'ultimo IDE del ramo 1.0.x è la 1.0.5r2 disponibile qui --> http://arduino.cc/en/Main/Software#toc2
L'ultima versione della EtherCard è qui --> GitHub - njh/EtherCard: EtherCard is an IPv4 driver for the ENC28J60 chip, compatible with Arduino IDE
ed è compatibile con la 1.0.5r2.
Per la corretta installazione pui seguire la guida di Luca Dentella in 17 episodi (http://www.lucadentella.it/category/enc28j60-arduino/) :astonished: il primo --> http://www.lucadentella.it/2012/02/12/enc28j60-e-arduino-1/

ok, grazie del consiglio, molto interessante, infatti mi sono soffermato sul tutorial n 7.
ho preso il codice da suo tutoria ma nel" byte Ethernet::buffer[700];"(4 riga) me lo sottolinea.
come posso cambiare???
il vostro ide lo accetta??
grazie

#include <EtherCard.h>
static byte mymac[] = {0xDD,0xDD,0xDD,0x00,0x00,0x01};
static byte myip[] = {192,168,1,2};
byte Ethernet::buffer[700];
const int ledPin = 2;
boolean ledStatus;
char* on = "ON";
char* off = "OFF";
char* statusLabel;
char* buttonLabel;
void setup () {
Serial.begin(57600);
Serial.println("WebLed Demo");
if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
Serial.println( "Failed to access Ethernet controller");
else
Serial.println("Ethernet controller initialized");
if (!ether.staticSetup(myip))
Serial.println("Failed to set IP address");
Serial.println();
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
ledStatus = false;
}
void loop() {
word len = ether.packetReceive();
word pos = ether.packetLoop(len);
if(pos) {
if(strstr((char *)Ethernet::buffer + pos, "GET /?status=ON") != 0) {
Serial.println("Received ON command");
ledStatus = true;
}
if(strstr((char *)Ethernet::buffer + pos, "GET /?status=OFF") != 0) {
Serial.println("Received OFF command");
ledStatus = false;
}
if(ledStatus) {
digitalWrite(ledPin, HIGH);
statusLabel = on;
buttonLabel = off;
} else {
digitalWrite(ledPin, LOW);
statusLabel = off;
buttonLabel = on;
}
BufferFiller bfill = ether.tcpOffset();
bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
"<html><head><title>WebLed</title></head>"
"<body>LED Status: $S "
"<a href=\"/?status=$S\"><input type=\"button\" value=\"$S\"></a>"
"</body></html>"
), statusLabel, buttonLabel, buttonLabel);
ether.httpServerReply(bfill.position());
}
}

Se sei arrivato al 7° tutorial vuol dire che l'installazione della libreria e del modulo sono andate a buon fine.
Per la parte di codice che hai pubblicato c'è un errore nel copia-incolla.
Il codice completo lo trovi qui --> GitHub - lucadentella/enc28j60_tutorial

ok ho fatto ma mi da lo stesso errore.
non capisco qual'è il problema.

Con la 1.0.5r2 mi compila, con la 1.5.7 mi da 4 kg di errori, tutorial 7:

#include <EtherCard.h>

static byte mymac[] = {0xDD,0xDD,0xDD,0x00,0x00,0x01};
static byte myip[] = {192,168,1,2};
byte Ethernet::buffer[700];

const int ledPin = 2;
boolean ledStatus;

char* on = "ON";
char* off = "OFF";
char* statusLabel;
char* buttonLabel;

void setup () {
 
  Serial.begin(57600);
  Serial.println("WebLed Demo");
 
  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
    Serial.println( "Failed to access Ethernet controller");
 else
   Serial.println("Ethernet controller initialized");
 
  if (!ether.staticSetup(myip))
    Serial.println("Failed to set IP address");

  Serial.println();
  
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  ledStatus = false;
}
  
void loop() {
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  
  if(pos) {
    
    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=ON") != 0) {
      Serial.println("Received ON command");
      ledStatus = true;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=OFF") != 0) {
      Serial.println("Received OFF command");
      ledStatus = false;
    }
    
    if(ledStatus) {
      digitalWrite(ledPin, HIGH);
      statusLabel = on;
      buttonLabel = off;
    } else {
      digitalWrite(ledPin, LOW);
      statusLabel = off;
      buttonLabel = on;
    }
      
    BufferFiller bfill = ether.tcpOffset();
    bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
      "Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
      "<html><head><title>WebLed</title></head>"
      "<body>LED Status: $S "
      "<a href=\"/?status=$S\"><input type=\"button\" value=\"$S\"></a>"
      "</body></html>"      
      ), statusLabel, buttonLabel, buttonLabel);
    ether.httpServerReply(bfill.position());
  }
}

Hai cambiato qualcosa??
GRAZIE

No, preso paro-paro dal link che ha messo @PaoloP

Ho provato, ma niente.
Mi sottolinea sempre la 4 riga.
Il punto è che con tutti gli sketch lo fa?
Cosa posso fare??

Cmq mi dice che ethernet non è dichiarata.
Vi posto un'immagine

Pubblica tutto lo sketch che stai usando

#include <EtherCard.h>

static byte mymac[] = {0xDD,0xDD,0xDD,0x00,0x00,0x01};
static byte myip[] = {192,168,1,2};
byte Ethernet::buffer[700];

const int ledPin = 2;
boolean ledStatus;

char* on = "ON";
char* off = "OFF";
char* statusLabel;
char* buttonLabel;

void setup () {
 
  Serial.begin(57600);
  Serial.println("WebLed Demo");
 
  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
    Serial.println( "Failed to access Ethernet controller");
 else
   Serial.println("Ethernet controller initialized");
 
  if (!ether.staticSetup(myip))
    Serial.println("Failed to set IP address");

  Serial.println();
  
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  ledStatus = false;
}
  
void loop() {
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  
  if(pos) {
    
    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=ON") != 0) {
      Serial.println("Received ON command");
      ledStatus = true;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=OFF") != 0) {
      Serial.println("Received OFF command");
      ledStatus = false;
    }
    
    if(ledStatus) {
      digitalWrite(ledPin, HIGH);
      statusLabel = on;
      buttonLabel = off;
    } else {
      digitalWrite(ledPin, LOW);
      statusLabel = off;
      buttonLabel = on;
    }
      
    BufferFiller bfill = ether.tcpOffset();
    bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
      "Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
      "<html><head><title>WebLed</title></head>"
      "<body>LED Status: $S "
      "<a href=\"/?status=$S\"><input type=\"button\" value=\"$S\"></a>"
      "</body></html>"      
      ), statusLabel, buttonLabel, buttonLabel);
    ether.httpServerReply(bfill.position());
  }
}

da questo sito:

Con la lib EtherCard presa da qui:

la compilazione è terminata perfettamente sia con IDE 1.0.5:

Dimensione del file binario dello sketch: 10.584 bytes
(su un massimo di 32.256 bytes)

che con IDE 1.5.7b:

Lo sketch usa 9.930 byte (30%) dello spazio disponibile per i programmi. Il massimo è 32.256 byte.
Le variabili globali usano 1.318 byte (64%) di memoria dinamica, lasciando altri 730 byte liberi per le variabili locali. Il massimo è 2.048 byte.