Hi there,
I´m trying to test my new ethernet shield (is a generic one, and it loks just like this: http://arduino.cc/en/uploads/Guide/ArduinoWithEthernetShield.jpg).
The thing is that I´m trying to test the shield without any success. I know that there´s no shield issue, because there was this one time that it worked, with the webserver example that comes with the ethernet library, but it suddenly stop working.
My ISP told me that they don´t close any ports, and they specially use the 8080 and 8021. I´ve tried port 80 and the other two without any luck.
I have an arduino mega 2560, and I´ve just insert the ethernet shield on top of it, in the usual way.
I´ve then tried this Hello world code that comes with the webduino library (webserver.h).
/* Web_HelloWorld.pde - very simple Webduino example */
#include "SPI.h"
#include "Ethernet.h"
#include "WebServer.h"
/* CHANGE THIS TO YOUR OWN UNIQUE VALUE. The MAC number should be
* different from any other devices on your network or you'll have
* problems receiving packets. */
static uint8_t mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE };
/* CHANGE THIS TO MATCH YOUR HOST NETWORK. Most home networks are in
* the 192.168.0.XXX or 192.168.1.XXX subrange. Pick an address
* that's not in use and isn't going to be automatically allocated by
* DHCP from your router. */
static uint8_t ip[] = { 192, 168, 2, 106 };
/* This creates an instance of the webserver. By specifying a prefix
* of "/", all pages will be at the root of the server. */
#define PREFIX "/"
WebServer webserver(PREFIX, 8021);
/* commands are functions that get called by the webserver framework
* they can read any posted data from client, and they output to the
* server to send data back to the web browser. */
void helloCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpSuccess();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type != WebServer::HEAD)
{
/* this defines some HTML text in read-only memory aka PROGMEM.
* This is needed to avoid having the string copied to our limited
* amount of RAM. */
P(helloMsg) = "<h1>Hello, World!</h1>";
/* this is a special form of print that outputs from PROGMEM */
server.printP(helloMsg);
}
}
void setup()
{
/* initialize the Ethernet adapter */
Ethernet.begin(mac, ip);
/* setup our default command that will be run when the user accesses
* the root page on the server */
webserver.setDefaultCommand(&helloCmd);
/* run the same command if you try to load /index.html, a common
* default page name */
webserver.addCommand("index.html", &helloCmd);
/* start the webserver */
webserver.begin();
}
void loop()
{
char buff[64];
int len = 64;
/* process incoming connections one at a time forever */
webserver.processConnection(buff, &len);
}
As my ethernet shield didn´t came with any mac address printed in the back, I´ve tried to find it out using my router:
Under Network Settings, I´ve search for "NUMBER OF DYNAMIC DHCP CLIENTS", and found this one, that I think it´s the arduino:
Host Name: WIZnetCCDE02
IP Address: 192.168.2.106
**MAC Address: 00:aa:bb:cc:dd:ee **
Expired Time: 6 Days 22 Hours 47 Minutes
Now, I´ve checked (cmd/ipconfig in my windows dos console):
IPV4 Address: 192.168.2.104
Subnet Mask: 255.255.255.0
Gateway: 192.168.2.2
My pc is connected to the internet using wifi.
I tried to ping the address: 192.168.2.106, and this is the result:
ping 192.168.2.106
pinging 192.168.2.106 with 32 bytes of data:
Reply from 192.168.2.104: Destination host unreachable.
What should I do? Any ideas? Thanks for your help!!
Rosamunda