Come comunicare con Ethernet Shield


ho provato collegare ethernet shield rev.3 con arduino uno rev.3 e ho scritto un codice d'esempio questo:
code: [select]

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

// network configuration.  gateway , subnet optional.

// media access control (ethernet hardware) address shield:
byte mac[] = { 0x90, 0xa2, 0xda, 0x0d, 0x23, 0x1f };   
//the ip address shield:
byte ip[] = { 192,168,1,4};   
// router's gateway address:
byte gateway[] = { 192, 168, 2, 1 };   
// subnet:
byte subnet[] = { 255, 255, 255, 0 };   
// initialize ethernet server library
// ip address , port want use
// (port 80 default http):
ethernetserver server(80);

void setup()
{
   // initialize ethernet device
   ethernet.begin(mac, ip, gateway, subnet);

  // start listening clients
   server.begin();
}

void loop()
{
   // if incoming client connects, there bytes available read:
   ethernetclient client = server.available();
   if (client == true) {
     // read bytes incoming client , write them back
     // clients connected server:
     server.write(client.read());
   }
}


ma non succede niente,che cosa devo fare? il mio router  รจ belkin n wireless router f5d8236-4.grazie.

code: [select]
byte ip[] = { 192,168,1,4};   
byte gateway[] = { 192, 168, 2, 1 };   

tanto per cminciare non sono nella stessa rete
per cui controlla che gli ip che stai usando siano giusti

sono passato di recente da queste sperimentazioni e ti assicuro che se usi gli esempi dell'ide , funzionano
ciao


Arduino Forum > International > Italiano > Generale (Moderator: leo72) > Come comunicare con Ethernet Shield


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial