Configurazione scheda ethernet


buonasera tutti, oggi mi è arrivata la scheda ethernet w5100 ma non riesco proprio farla funzionare.

essendo mega compatibile l'ho inserita sopra all'arduino, attaccato la rete e provato come prima cosa caricare lo sketch di esempio dhcpaddressprinter.

purtroppo non mi dà nessun risultato, il monitor seriale resta vuoto. la scheda è collegata ad uno switch collegato direttamente al router.

vi allego il codice che ho caricato.  grazie mille per l'aiuto.

code: [select]

#include <spi.h>
#include <ethernet.h>

// enter mac address controller below.
// newer ethernet shields have mac address printed on sticker on shield
byte mac[] = { 
  0x00, 0xaa, 0xbb, 0xcc, 0xde, 0x02 };

// initialize ethernet client library
// ip address , port of server
// want connect (port 80 default http):
ethernetclient client;

void setup() {
// open serial communications , wait port open:
  serial.begin(9600);
  // check needed on leonardo:

    ; // wait serial port connect. needed leonardo only
 

  // start ethernet connection:
  if (ethernet.begin(mac) == 0) {
    serial.println("failed configure ethernet using dhcp");
    // no point in carrying on, nothing forevermore:
    for(;;)
      ;
  }
  // print local ip address:
  serial.print("my ip address: ");
  (byte thisbyte = 0; thisbyte < 4; thisbyte++) {
    // print value of each byte of ip address:
    serial.print(ethernet.localip()[thisbyte], dec);
    serial.print(".");
  }
  serial.println();
}

void loop() {

}

nella setup() per prima cosa aggiungi un delay di 1 secondo e una frase:
code: [select]
void setup() {
  delay(1000);
  serial.begin(9600);   // open serial communications , wait port open:
  serial.println("inizio");


inoltre quella riga con ;  e commento non serve nulla.
ora qualcosa dovrebbe mostrare.
se non mostra "failed configure ethernet using dhcp"   dovrebbe arrivare stamparti l'ip


Arduino Forum > International > Italiano > Hardware (Moderator: leo72) > Configurazione scheda ethernet


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support