title: Why is my code throwing these errors: "error: espcomm_upload_mem failed" when I try to upload code to Esp8266 module via Mega 2560? ESP8266-01 Arduino
body: <p>When I upload my code to the ESP-8266 Module, I get this error message in the console: <code>warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed </code></p>
  <p>here are my connections:
  3v3-3v3,
  gnd-gnd,
  tx-tx,
  RX-RX,
  ch_pd-3v3.</p>
  <p>I've read many posts, but none of them fixed my problem. Is there anyone who knows the solution or someone who had the same problem? Thanks! I tried various combinations like Tx to Rx, Rx to Tx. Pulling off reset and ch_pd. Supplying external power source, supplying power directly from Arduino using 3.3V.</p>
  <p>here is my code:</p>
  <pre><code>
  void setup() {
    pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
  }
  
  // the loop function runs over and over again forever
  void loop() {
    digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                      // but actually the LED is on; this is because 
                                      // it is acive low on the ESP-01)
    delay(1000);                      // Wait for a second
    digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
    delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
  }
  
  }
  
  </code></pre>