Go Down

Topic: Arduino and ENC28j60 - problem (Read 1 time) previous topic - next topic

chabov

Hello everyone!

This is my first post. and besides, I'm Polish and my english is not the best.

I am interested in Arduino, I bury it and program it.
Projects so far very simple. But I would like to have my Arduino eyes out. smiley

I bought ENC28J60 Ethernet module.
I plugged the library added to it.
And, unfortunately, does not work ... Maybe some hints as to embrace?
I have this code but I do not know why it does not: (

Quote
#include <EtherCard.h>
    #include "etherShield.h"
    #include <ETHER_28J60.h>

    static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
    static byte myip[] = { 192,168,0,105 };
    static byte myport = { 80 };
    int i = 0;

    BufferFiller bfill;

    #define LED 4  // define LED pin
    bool ledStatus = false;
     ETHER_28J60 e;

    void setup()
    {
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);

  delay(1000);
  e.setup(mymac, myip, myport);
    }

    void loop()
    {
       char* params;

  if (params = e.serviceRequest())
  {
    if (strcmp(params, "lampka") == 0)
    {
        if(i == 0) {
            digitalWrite(LED, HIGH);
            i=1;
       } else if(i == 1) {
            digitalWrite(LED, LOW);
            i=0;
        }
        e.print("Done!");
    } else if (strcmp(params, "lampka_off") == 0) {
       digitalWrite(LED, LOW);
        i=0;
        e.print("OFF-DONE!");
    } else if (strcmp(params, "lampka_on") == 0) {
        digitalWrite(LED, HIGH);
        i=1;
        e.print("ON-DONE!");
    } else if (strcmp(params, "lampka_status") == 0) {
        e.print(i);
    } else {
        e.print("Hello, World! smiley-razz");
    }
    e.respond();
  }
    }


and when I entered my address WAN  and command into the browser, nothing happens: (

Ports on the routher have made ??....
Please HELP

_Leo_

I just tried your code and it worked. The web browser displayed "Hello, World! smiley-razz".

Can you ping the board? If not then check your WAN setup.
Leo

Project "ALTDuino" - A homemade altimeter for model rockets.
http://www.altduino.de

CrossRoads

Please explain how you have the ENC28J60 Ethernet module connected to the Arduino.
It is not clear from your code listing or your explanation.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

NI$HANT

Please check your spi connection most probably the problem is there
"Real Men can Accomplish  Anything"

- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੁਂ!

gianotto

Hello.
Hope you already got a solution, but anyway here I go:

When calling the setup method, try to use a 4th argument where is the pin connected to your CS (CableSelect) of your ethernet controller.

e.setup(mymac, myip, myport, pinCS);

Go Up