I purchased an Ethernet shield, and yesterday I got it. But I still have troubles getting it up and running...
I'll give as much details as possible.
Code: I use a slightly edited version of the 'WebClient' example:
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // standard MAC
byte ip[] = { 192,168,1,172 }; // unused IP, I pinged it
byte server[] = { 192,168,1,100 }; // desktop, 192.168.1.100
byte gateway[] = { 192, 168, 1, 1 }; //router's IP
byte subnet[] = { 255, 255, 255, 0 }; //subnetmaskClient client(server, 80);
void setup()
{
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
Ethernet.begin(mac, ip, gateway, subnet);
Serial.begin(9600);delay(1000);
Serial.println("connecting...");
Serial.println(client.connect());
Serial.println(client.connected());
//Serial.printlnif (client.connect()) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
digitalWrite(15, HIGH);
} else {
Serial.println("connection failed");
digitalWrite(16, HIGH);
}
}void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for( ; ; )
;
}
}
Router: the router we've got is a LinkSys WAG200G. It has four ethernet ports and WiFi.
(such a thing:
)
Specs:
- Supports 802.11g and 802.11b wireless LAN
- Built-in ADSL modem with G.lite, g.992.3,g.992.5, G.dmt & T1. 413 supp
- Supports 4 10/100 Auto MDI/MDI-X LAN switch ports
- Enhanced security mgmt functions: Port Filtering, MAC & IP Add Filtering,
DMZ Hosting & NAT Technology- Build-in web graphical user i/face for easy config from any web browser
- Support for RFC1483, PPPoE and PPPoA connections
- Statefull Packet Inspection (SPI) firewall with DoS prevention
- Wireless Access Lists to enhance wireless security
- Supports VPN Passthrough for IPSec, PPTP, and L2TP Protocols
- Supports Static and Dynamic Routing (RIP1 and 2)
- Remote administration and remote upgrades available over the Internet
Port 1 is used by the desktop I'm currently working on,http://www.arduino.cc/yabbfiles/Templates/Forum/default/code.gif port 3 is sometimes used by my old laptop, and sometimes by the shield.
I can't get access to it, because my dad forget the username and password... I'm only planning to reset it if there's no other way.
Shield: ethernet shield from DFrobot (WIZnet5100 chip), comptible with the official ethernet library.
IP, subnet, gateway, ...: The IP of my desktop is 192.168.1.100, so I use 192.168.1.172 for my Arduino. As subnet I use 255.255.255.0, and as gateway 192.168.1.1.
Print of the ipconfig command (translated):
C: \ Documents and Settings \ HP_Eigenaar> ipconfig
Windows IP Configuration
Ethernet adapter Wireless Network Connection:
Connection Spec. DNS suffix:
IP address. . . . . . . . . . . . . : 192.168.1.100
Subnet mask. . . . . . . . . . . : 255.255.255.0
Default Gateway. . . . . . . . . : 192.168.1.1Ethernet adapter LAN:
State. . . . . . . . . . . . . . . . . : Media disconnected
And on my laptop I get the same, except for the IP, of course, there it is 192.168.1.101.
I tried 'shared internet', by enabling it on my desktop and putting the jack from my Arduino to the jack named ethernet. My computer connects through WiFi (I heard that could cause the problem, is that true?). It didn't work... When I put it in a port of the router I can ping, it with my desktop, but now, I couldn't...
Any suggestions?