Pages: [1]   Go Down
Author Topic: Arduino and ENC28j60 - problem  (Read 1282 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Germany
Offline Offline
Jr. Member
**
Karma: 3
Posts: 83
I'm a newbie
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Leo

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


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please explain how you have the ENC28J60 Ethernet module connected to the Arduino.
It is not clear from your code listing or your explanation.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1616
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please check your spi connection most probably the problem is there
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
Logged

Pages: [1]   Go Up
Jump to: