Go Down

Topic: Help with ENC28J60 (edited) (Read 2386 times) previous topic - next topic

AmazeCPK

Sep 11, 2014, 08:48 pm Last Edit: Sep 12, 2014, 03:38 am by AmazeCPK Reason: 1
I'm having a hard time figuring this out. I'm using the ethercard_master library and have hooked up all the pins accordingly.
The unit I'm using is http://www.ebay.com/itm/251612003167?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

I'm trying to run the backsoon script but I'm running into problems. When trying to connect to the ip address, my browser gives me an error
Code: [Select]
This service is currently unavailable

The main server is currently off-line.
Please try again later.


I've also tried port forwarding my module with no avail
I've tried changing the mac address as well, and I'm pretty sure I'm connected to the right gateway address

The Serial Monitor is producing this
Code: [Select]
[backSoon]
IP:  192.168.1.33
GW:  192.168.1.1
DNS: 192.168.1.1


however connecting to the IP gives me the error as stated before.
Any help would be greatly appreciated.

Arduino Code:
Code: [Select]
// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

#define STATIC 0  // set to 1 to disable DHCP (adjust myip/gwip values below)

#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,33 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#endif

// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x39 };

byte Ethernet::buffer[500]; // tcp/ip send and receive buffer

const char page[] PROGMEM =
"HTTP/1.0 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
"<html>"
 "<head><title>"
   "Service Temporarily Unavailable"
 "</title></head>"
 "<body>"
   "<h3>This service is currently unavailable</h3>"
   "<p><em>"
     "The main server is currently off-line.<br />"
     "Please try again later."
   "</em></p>"
 "</body>"
"</html>"
;

void setup(){
 Serial.begin(57600);
 Serial.println("\n[backSoon]");
 
 if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
   Serial.println( "Failed to access Ethernet controller");
#if STATIC
 ether.staticSetup(myip, gwip);
#else
 if (!ether.dhcpSetup())
   Serial.println("DHCP failed");
#endif

 ether.printIp("IP:  ", ether.myip);
 ether.printIp("GW:  ", ether.gwip);  
 ether.printIp("DNS: ", ether.dnsip);  
}

void loop(){
 // wait for an incoming TCP packet, but ignore its contents
 if (ether.packetLoop(ether.packetReceive())) {
   memcpy_P(ether.tcpOffset(), page, sizeof page);
   ether.httpServerReply(sizeof page - 1);
 }
}

Peter_n

You have a sketch that writes "This service is currently unavailable" when a browser would connect to it.
So when you connect to it with a browser, you get the text "This service is currently unavailable".
You can change that text into "Hello World", so you would see "Hello World" in your browser.

AmazeCPK

#2
Sep 12, 2014, 12:49 am Last Edit: Sep 12, 2014, 03:38 am by AmazeCPK Reason: 1
I thought that was an error message  :~ . Well then, you are a wonderful person. Thank you very much

New problem. I'm trying to access my arduino from outside my LAN.
This tutorial :http://forum.bildr.org/viewtopic.php?t=416
talks about connecting the arduino directly to the modem. I've tried that and now the only way I can connect to it is from the address 10.0.0.4.
However that's still only on my LAN. I want to be able to connect through mobile devices anywhere in the world.
Does anyone know how i can accomplish this?

Go Up