error to upload example sketch when arduino board is paired with ethernet shield

anyone please help me. or tell me if i am doing wrong.
i cant upload my sketch when my ethernet shield is connected to arduino uno and mega2560 board without internet connection. but without the ethernet shield, the sketch is uploaded. does i have to connect my board to internet first? so then the sketch can be uploaded.
it said the "programmer is not responding" for uno board and "connection timed out" for mega2560 board.

Where is the error?
The ethernet shield is probably using the serial pins. Which one is it?

im sorry, im new in this arduino things. im a student and i doing my final year project by using arduino. i dont know about the serial pin because i cant find in on the board.

Which ethernet shield are you using?

wiznet ethernet w5100

Read the documentation for it. See if it uses pins 0 and 1.

sorry. which kind of documentation?? is it like this ?

Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work.

okay now does i have to connect my ethernet shield to the internet before uploading the sketch or it is not necessary to do that first before uploading the sketch.

See if it uses pins 0 and 1.

It doesn't, WIZnet shields use SPI.

Try this:

  • Remove the shield from the Arduino
  • File > Examples > 01.Basic > Blink
  • Sketch > Upload - After the upload you should see the LED on the Arduino blinking, on for one second, off for one second.
  • Unplug the Arduino from the computer
  • Plug the shield into the Arduino
  • Plug the Arduino into the computer
  • Look between the Arduino and the shield to see if the LED is blinking.

Does the LED blink the same as before with the shield connected?

does i have to connect my ethernet shield to the internet before uploading the sketch or it is not necessary to do that first before uploading the sketch.

It shouldn't be necessary. I have multiple different Ethernet shields and I can upload to the Arduino with any of them.

alright. thank you. now my board is blinking. so thats mean i just have to connect the board to my router now and test it. right?

No, that test was just to determine if the Ethernet shield is only interfering with uploads or if it's disabling the microcontroller completely. If it's blinking at the same rate with the Ethernet shield connected that means the microcontroller is running correctly.

Here's another test you can try:

  • Unplug the Arduino
  • Remove the shield
  • Plug in the Arduino to USB
  • Upload the following program:
void setup() {

void loop() {
  • Tools > Serial Monitor
  • Select 9600 from the drop down menu at the bottom right corner of the Serial Monitor window. You should see "hello" being printed once a second.
  • Close Serial Monitor
  • Unplug your Arduino from USB
  • Plug in the shield
  • Plug your Arduino into the USB
  • Tools > Serial Monitor

Do you still see "hello" being printed once a second?

no there is no "hello" came out at the monitor. or does i have to connect my shield to high speed of internet connection.

Do you see "hello" when the shield is not connected?