Go Down

Topic: Problem with Ethernet Shield (Read 252 times) previous topic - next topic

leosa99

Oct 21, 2015, 07:37 pm Last Edit: Oct 21, 2015, 07:38 pm by leosa99
Hi  :)
I've got a little problem with my shield,
I'm running this code :
 
Code: [Select]

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {
  0x90, 0xA2, 0xDA, 0x10, 0x0A, 0x62
};

EthernetClient client;
IPAddress ipLocal(192,168,133,20);
IPAddress dnss(212,27,40,241);

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
 
 
  Ethernet.begin(mac,ipLocal,dnss);
 

  Serial.println("test");
  // print your local IP address:
  Serial.print("My IP address: ");
  Serial.println(Ethernet.localIP());
  // Here is the problem.
  client.connect("google.com", 80))

  Serial.println("test");
}

Before the connect function, everything is ok but after the connect instruction, anything happens, i mean the "test" doesn't show up.

I have already searched on Google but i haven't find any solution for my problem.

Thanks in advance for your replies ;)

And sorry for my bad english ...

pert

#1
Oct 22, 2015, 07:33 am Last Edit: Oct 22, 2015, 08:04 am by pert
Code: [Select]

  client.connect("google.com", 80))

You have a ) at the end of the line instead of a ; though I don't think that's the real problem. It works for me after a bit of a delay.

leosa99

Yes I think it's an hardware problem.

tri413

I have run into issues because of cables (crossovers) and routers.  Have you tried the begin() with DNS?  Are you sure your IP is right for your network?  Maybe you could try the WebServer.ino sample to see if your device can receive.

Ethernet.begin(mac,ipLocal,dnss);  <---- remove dnss param?

Have you tried the standard WebClient samples?  I have one in my Github:
https://github.com/Tri413/Arduino/blob/master/WebClient/WebClient.ino

leosa99

Thanks for your answer tri413 but i solved my problem by downloading the last IDE on arduino.org and using the ethernet2 library. If it can help anybody ...

pert

The arduino Ethernet library only supports the W5100 Ethernet controller found on the Ethernet Shield, and not the W5500 on your Ethernet Shield 2. If you want to continue using the arduino.cc IDE, which is under much more active development and has stronger community support, you can copy the Ethernet2 library from the arduino.org IDE installation to your sketchbook/libraries folder or use one of these alternative Ethernet libraries which support the W5500:

Go Up