Problema de Conexão Módulo ENC28J60


estou com problema para conectar o módulo de ethernet que conecta o arduino mega com o roteador tp link tl-mr3020

#include <ethercard.h>


static byte mymac[] = { 0x90, 0xa2,  0xda, 0x0e, 0xca, 0x2f };
static byte myip[] = { 192,168,0,110 };
static byte gwip[] = { 192,168,0,254 };

byte ethernet::buffer[700];

static uint32_t tempo;

char websiteip[] = "34.239.131.81";

static void my_callback (byte status, word off, word len) {
  serial.println(">>>");
  ethernet::buffer[off + 300] = 0;
  serial.print((const char*) ethernet::buffer + off);
  serial.println("...");
}


void setup() {
  serial.begin(57600);
  serial.println("inicio setup");
  if (ether.begin(sizeof ethernet::buffer, mymac) == 0)
    serial.println(f("failed access ethernet controller"));
  serial.println("1");
  ether.staticsetup(myip, gwip);
  //if (!ether.dhcpsetup())
  //  serial.println("dhcp failed");
  serial.println("2");
  ether.printip("ip:  ", ether.myip);
  serial.println("3");
  ether.printip("gw:  ", ether.gwip);
  serial.println("4");
  ether.printip("dns: ", ether.dnsip);
  serial.println("5");
  //ether.parseip(ether.hisip, websiteip);
  ether.printip("srv: ", ether.hisip);
  serial.println("fim setup");
}
void loop() {
  ether.packetloop(ether.packetreceive());
  if (millis() > tempo) {
    tempo = millis() + 7000;
    delay(500);
  }

}

e que problema é que estás ter? de onde tiraste esse código?


Arduino Forum > International > Portugues > Problema de Conexão Módulo ENC28J60


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???