If I comment out the "EthernetClient client;" line the LED starts to blink. Whats wrong with this?
It doesn't make sense that commenting out that line, and only that line, causes the LED to start blinking.
Move the Serial.begin() statement to the top of setup(). Add a Serial.print() statement before and after Ethernet.begin(). It is for more likely that that call is being made but never returns.
Forgot to mention that the Ethernet shield uses pins 10, 11, 12, and 13 on the 328-based Arduinos. If you are using one of them, you'll need to move your LED to another pin.
Arduino communicates with both the W5500 and SD card using the SPI bus (through the ICSP header). This is on digital pins 10, 11, 12, and 13 on the Uno
PaulS:
It doesn't make sense that commenting out that line, and only that line, causes the LED to start blinking.
Move the Serial.begin() statement to the top of setup(). Add a Serial.print() statement before and after Ethernet.begin(). It is for more likely that that call is being made but never returns.
Forgot to mention that the Ethernet shield uses pins 10, 11, 12, and 13 on the 328-based Arduinos. If you are using one of them, you'll need to move your LED to another pin.
I use UNO with Ethernet shield. I've tried to move LED to PIN 9 : pinMode(9, OUTPUT) with no success.
Now the LED doesn't blink with or without the Ethernet.begin(mac, ip); line.
I've tried also PIN 3. No success. Where to move the LED?
And this is the warning that you get if you set the compiler warnings to ALL in preferences.
C:\Users\sterretje\AppData\Local\Temp\arduino_modified_sketch_594459\sketch_mar07a.ino:1:0: warning: "LED_BUILTIN" redefined
#define LED_BUILTIN 9
^
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:257:0,
from C:\Users\sterretje\AppData\Local\Temp\arduino_build_303495\sketch\sketch_mar07a.ino.cpp:1:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:54:0: note: this is the location of the previous definition
#define LED_BUILTIN 13
^
Understand what you are doing. You should not redefine a predefined pin. How would you have added a second led (on pin 9)?
E.g. with
#define OTHERLED 9
And in setup() you would have used something like
pinMode(OTHERLED, OUTPUT);
And to control the led, you would have used e.g.
digitalWrite(OTHERLED, HIGH);
Now find a decent name for OTHERLED and you're good to go.
With regards to your original problem, your shield uses the SPI bus and pin 13 is the SPI clock. Pin 13 is also the built-in led and hence you have a conflict.