Cannot upload project after conecting Wifi shield

Hello. I am trying to uplaod any program to Arduino uno while Wifi shield ESP8266 is on, but it gives me this error:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

I tried uploading the code without Wifi shield on, then unplugging Ardunio, putting on the Wifi shield and then connecting to computer. But then the program doesn't seem to run and nothing gets printed on the serial monitor. What can I do?

I have the following code:

#include <SPI.h>
#include <WiFi.h>

void setup() {

  // initialize serial and wait for the port to open:

  Serial.begin(9600);

  while(!Serial) ;

  // attempt to connect using WEP encryption:

  Serial.println("Initializing Wifi...");

  printMacAddress();

  // scan for existing networks:

  Serial.println("Scanning available networks...");

  listNetworks();
}

void loop() {

  delay(10000);

  // scan for existing networks:

  Serial.println("Scanning available networks...");

  listNetworks();
}

void printMacAddress() {

  // the MAC address of your Wifi shield

  byte mac[6];

  // print your MAC address:

  WiFi.macAddress(mac);

  Serial.print("MAC: ");

  Serial.print(mac[5],HEX);

  Serial.print(":");

  Serial.print(mac[4],HEX);

  Serial.print(":");

  Serial.print(mac[3],HEX);

  Serial.print(":");

  Serial.print(mac[2],HEX);

  Serial.print(":");

  Serial.print(mac[1],HEX);

  Serial.print(":");

  Serial.println(mac[0],HEX);
}

void listNetworks() {

  // scan for nearby networks:

  Serial.println("** Scan Networks **");

  byte numSsid = WiFi.scanNetworks();

  // print the list of networks seen:

  Serial.print("number of available networks:");

  Serial.println(numSsid);

  // print the network number and name for each network found:

  for (int thisNet = 0; thisNet<numSsid; thisNet++) {

    Serial.print(thisNet);

    Serial.print(") ");

    Serial.print(WiFi.SSID(thisNet));

    Serial.print("\tSignal: ");

    Serial.print(WiFi.RSSI(thisNet));

    Serial.print(" dBm");

    Serial.print("\tEncryption: ");

    Serial.println(WiFi.encryptionType(thisNet));

  }
}

What Arduino?

What WiFi shield?

What code? Read the forum guidelines to see how to properly post code and some hints on how to get the best from the forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Have you tried the suggestions in the Troubleshooting uploads page?

I edited my post to include these things

Is that library written for the processor on the Uno? Post a link to where you got the library.

Please provide a link to the shield.

It sounds like the Uno communicates with the shield over the serial port (pins 0 and 1). Those same pins are used for the communication over USB. Hence the upload problem and maybe why you don't see anything in serial monitor.

The code is taken from here https://www.arduino.cc/en/Guide/ArduinoWiFiShield. I don't know where the library comes from. But it's doesnt matter, becasue even if I try to upload epmty sketch, it shows the same error.

Here's the link to the shield https://www.amazon.com/dp/B07DMZVQ4D?psc=1&ref=ppx_yo2_dt_b_product_details

Read the documentation that came with the shield. You will probably have to change the dip switches and make use of SoftwareSerial.

There didn't come any documentation, where do I find one?

Sorry, I don't know.

  1. What does it say around the dipswitches? There might be an indication there.
  2. Does your upload problem disappear if you put all of them in the opposite position?
  3. Do you have a multimeter?

Here's what the switches are:

SW1 Connect ESP8266 TX to pin D0
SW2 Connect ESP8266 RX to pin D1
SW3 Enable bootloader mode
SW4 Use DFU LED to show serial activity (?)

No the probelm does not disappear when all the switches are on. And no I dont have a multimeter.

SW1 and SW2 should be in the OFF position so they do NOT connect to Arduino pins. That should allow you to upload with the shield mounted.

Can you take a sharp photo of the top of the shield exactly parallel; the angle of the images on amazon don't allow me to read the text on the board. You might have to wire some pins of the ESP to pins on the Arduino headers and I would like to see if I can figure that out.

OK, I don't see a direct way to get it to work. Basically dip switches off, connect RX and TX at the left to two pins on the Arduino headers and use software serial. Because the ESP is a 3.3V device, you will need a voltage divider between the the pin that you use on the Arduino and the RX pin of the shield.

Did you read the reviews on Amazon? Based on that, I would return it.

You can do a google search for elecshop , go to the images (https://www.google.com/search?q=elecshop&client=firefox-b-d&sa=N&biw=1920&bih=1075&sxsrf=AOaemvKy5fyrRbuQM4VYvaViSTGKf6tZUg:1636002697130&tbm=isch&source=iu&ictx=1&fir=oI7RN0o0ysvwRM%2Cy3ps4v4aLHp0-M%2C_%3BZqkHIAupwo2prM%2C25eqn0eSuROOiM%2C_%3BZv18mEhbBUZWeM%2CU1Vk_acubej8bM%2C_%3BHp-FXF-5qNFtqM%2CaE_FAxBhrVARfM%2C_%3BWkiVoKBiFqt4IM%2CwjUeA9GMTGpA0M%2C_%3BID49u_-PiD9rNM%2CMr7Y0kffaAvEuM%2C_%3BB8VeiFmDclVzmM%2CKQeLtfwzqQ32jM%2C_%3B-GBwNmq1m294jM%2CC-cVnE8iEwtDUM%2C_%3BjUN9PeIIWqhJ3M%2ClPywOfJGhuBRYM%2C_%3BtS2YZkfayWSi9M%2CU1Vk_acubej8bM%2C_&vet=1&usg=AI4_-kQNqudOJZfL-s6y3sG9g894XldSpQ&ved=2ahUKEwigmvT8-P3zAhWHUMAKHfmmAY84ChD1AXoECBUQAQ#imgrc=Hp-FXF-5qNFtqM) and follow the links. It will be a lot of work.

I did follow 2 links

  1. Arduino ESP8266 WiFi Shield (elecshop.ml) by WangTongze Comparison | Claus bloggt es
  2. How to connect Wi-Fi shield ESP-12E-ESP8266-UART-WIFI-Wireless-Shield with Arduino - Arduino Stack Exchange

The latter might provide some solutions.

I decided to just return the item. Which wifi-shield would you recommend to buy?

No idea. You can consider to buy an Arduino with built-in Wifi. You also can't go wrong with SparkFun or AdaFruit shields; you pay for it but you have support, tutorials and so on.

Further you might not need a shield but use a small breakout module like https://www.robotics.org.za/ESP-01.

And there is life outside Arduino :wink: You can e.g. get a Wemos D1 Mini which you can consider a (smaller) Arduino with built-in wifi; a little less pins, only one analog input. Or a Wemos D32 which has two cores which can be beneficial. Note that both mentioned boards are 3.3V.

It all depends on your needs / requirements.

Note:
I would start a new topic in the project guidance section asking for advise. Provide details of what you want to do and refer to your poor experience with the board in this topic. You will probably get similar answers as in this reply but from people with more experience when it comes to WiFi.