Bonjour,
J'ai un nano avec un shield 28j60 embrochable, je souhaite dialoguer en udp et je ne parviens pas à initier l'Ethernet avec
ether.begin(sizeof Ethernet::buffer, mymac, 10);
Je vous joint le code.
Merci pour votre aide.
#include <EtherCard.h>
#include <IPAddress.h>
static byte mymac[] = { 0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F };
// ethernet interface ip address
static byte myip[] = { 192, 168, 1, 179 }; // Mon ip
static byte gwip[] = { 192, 168, 1, 254 }; // gateway ip
static byte dnsip[] = { 192, 168, 1, 254 }; // Serveur DNS
static byte destip[] = {192, 168, 1, 177}; // ip Destinataire
static int myport = 8889, destport = 8888; // Port entrant et port sortant
byte Ethernet::buffer[500];
static uint32_t timer;
void setup () {
Serial.begin(9600);
Serial.println(F("..."));
ether.staticSetup(myip, gwip, dnsip); // Configure l'ip, le gateway, le DNS
Serial.println(F("IP / GW / DNS..."));
Serial.print("mac: "); Serial.print(mymac[0]); Serial.print(" : "); Serial.print(mymac[1]); Serial.print(" : "); Serial.print(mymac[2]); Serial.print(" : "); Serial.print(mymac[3]); Serial.print(" : "); Serial.print(mymac[4]); Serial.print(" : "); Serial.println(mymac[5]);
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
//ether.printIp("SRV: ", ether.hisip);
Serial.print(F("\nPort"));
//register udpSerialPrint() to port 8888
// ether.udpServerListenOnPort(&udpSerialPrint, 8888);
Serial.println(F("....Ok"));
Serial.print(F("begin"));
ether.begin(sizeof Ethernet::buffer, mymac, 10);
Serial.println(F("...Ok"));
Serial.println(F("Pret"));
}