I can send AT Commands, but cannot upload sketch to ESP8266 via Generic ESP Module I can send AT commands to the ESP8266 - 01 but I am not able to upload the sketch.

I have connected TX-RX of module to TX-RX of Arduino, GND to GND, CH_PD, RST and VCC to 3.3V.

Here is the code I'm trying to upload - 

#include &lt;ESP8266WiFi.h&gt;

const char* ssid = "ssid";
const char* password = "password";


void setup() {
  Serial.begin(115200);
  delay(10);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println(".");
    Serial.println("Connected to ");
    Serial.println(ssid);
  }
}

void loop() {
  Serial.println("Hello, Internet");
  delay(1000);
  Serial.println("IP Address");
  Serial.println(WiFi.localIP());
  delay(2000);
}


Here is the error I am getting.

Arduino: 1.8.1 (Windows 8.1), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

Sketch uses 225921 bytes (52%) of program storage space. Maximum is 434160 bytes.
Global variables use 31864 bytes (38%) of dynamic memory, leaving 50056 bytes for local variables. Maximum is 81920 bytes.
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed


Please suggest something.
In order to put the ESP into programming mode, you need to connect GPIO0 to ground as you power it up.

(I have a push button attached to my proto board for this purpose.)