Go Down

Topic: ENC28J60 + Arduino Nano Problem (Read 776 times) previous topic - next topic

Vorax

Recently, my ENC28j60 breakout Board arrived. Then, I started downloading libraries, testing examples and only a few (and simple) codes work. I.e :

Code: [Select]
#include "etherShield.h"
#include "ETHER_28J60.h"
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};                                                           
static uint8_t ip[4] = {192, 168, 1, 15};                     
static uint16_t port = 80;                                   
ETHER_28J60 ethernet;
void setup()
{
  ethernet.setup(mac, ip, port);
}

void loop()
{
  if (ethernet.serviceRequest())
  {
    ethernet.print("<H1>Hello World</H1>");
    ethernet.respond();
  }
  delay(100);
}


Success!



BUT, this one for i.e. (from the same library) don't work!

Code: [Select]

#include "etherShield.h"
#include "ETHER_28J60.h"

int outputPin = 6;
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};                                                             
static uint8_t ip[4] = {192, 168, 1, 15};                                                                                                                                         
static uint16_t port = 80;                                 
ETHER_28J60 e;

void setup()
{
  e.setup(mac, ip, port);
  pinMode(outputPin, OUTPUT);
}

void loop()
{
  char* params;
  if (params = e.serviceRequest())
  {
    e.print("<H1>Web Remote</H1>");
    if (strcmp(params, "?cmd=on") == 0)
    {
      digitalWrite(outputPin, HIGH);
      e.print("<A HREF='?cmd=off'>Turn off</A>");
    }
    else if (strcmp(params, "?cmd=off") == 0)
    {
      digitalWrite(outputPin, LOW);
      e.print("<A HREF='?cmd=on'>Turn on</A>");
    }
    e.respond();
  }
}




I'm using IDE 1.0.3 but tried with 0022 and nothing!


DHCP examples from Ethercard Library returns ''DNS failed''

I don't know if helps but i realized that the SCK pin stuck HIGH when program dont work. (due to the led connected on pin 13)


Thanks!





Go Up