small medium large xlarge

Back to: All Forums  Arduino
17 Oct 2010, 13:42
Sven Riedel (8 posts)

In chapter 6, Ethernet/TimeServer/TimeServer.pde, Ethernet.begin() is missing a very important parameter: the gateway for the LAN. While the example works fine if you connect your arduino directly to the internet, if you however try the example in a LAN with a router, noone is going to care about your connection attempts and the example will fail.

The code would have to be changed as follows:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte my_ip[] = { 192, 168, 13, 90 };
byte time_server[] = { 192, 43, 244, 18 }; //
byte gateway[] = { 192, 168, 13, 254 }; // IP of your cable or DSL router

Client client( time_server, DAYTIME_PORT );

void setup() {
  Ethernet.begin( mac, my_ip, gateway );
  Serial.begin( 9600 );

Keep Bob Marleys less popular song “No router, no time” in mind ;)

21 Oct 2010, 14:57
Maik Schmidt (120 posts)

Hi Sven!

The text contains a hint regarding the gateway address, but I think you’re right: I should add a code example.

Keep Bob Marleys less popular song “No router, no time” in mind ;)

Can’t get it out of my head now :-)

Thank you very much for your suggestions!!

Best, Maik

You must be logged in to comment