user49316: I can upload simple sketch on my ESP-01 like:
void setup() {
  Serial.begin(115200);
  Serial.println("Hello there"); 
}
void loop() {
  Serial.println("Hello from loop");
  delay(1000);
}

I also ran successfully the sample ESPWebServer -> HelloServer
But if just modify my sketch to include #include <ESP8266WiFi.h>
#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(115200);
  Serial.println("Hello there"); 
}
void loop() {
  Serial.println("Hello from loop");
  delay(1000);
}

I got this result in the serial monitor:
  ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld

My ESP-01 is connected to my computer through FT232RL FTDI with the following cabling:

FTDI GND - GND
ESP TX - FTDI RX
ESP RX - FTDI TX
ESP VCC - VCC 3.3V
ESP GND - GND
ESP CH_PD - VCC
ESP GPIO2 - VCC
ESP GPI00 - GND to upload sketch, VCC to run sketch

Here is a picture of my cabling (the USB of both the TTL and power supply MB102 are connected to my laptop):

Also, regularly my sketch fails to load correctly:
-Sometimes it does not load at all and I get this after compilation before uploading starts:
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

- Sometimes it fails at the end of the upload:
Uploading 256064 bytes from C:\Users\20000263\AppData\Local\Temp\arduino_build_32221/ESP01-Basic.ino.bin to flash at 0x00000000
................................................................................ [ 31% ]
................................................................................ [ 63% ]
................................................................................ [ 95% ]
..........warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

Any idea about what is wrong ?

user31038: FTDI adapters often don't provide enough current to run the power-hungry wifi features of the ESP8266. So as soon as you fire up wifi, you brownout the chip and cause it to reset.
Use a battery, a dedicated ESP8266 flasher, a 3.3v LDO, or something besides the on-board 3.3v connection the USB-Serial adapter provides.

49316: <p>I can upload simple sketch on my ESP-01 like:</p>

<pre><code>void setup() {
  Serial.begin(115200);
  Serial.println("Hello there"); 
}
void loop() {
  Serial.println("Hello from loop");
  delay(1000);
}
</code></pre>

<p>I also ran successfully the sample ESPWebServer -> HelloServer</p>

<p>But if just modify my sketch to include <code>#include &lt;ESP8266WiFi.h&gt;</code></p>

<pre><code>#include &lt;ESP8266WiFi.h&gt;

void setup() {
  Serial.begin(115200);
  Serial.println("Hello there"); 
}
void loop() {
  Serial.println("Hello from loop");
  delay(1000);
}
</code></pre>

<p>I got this result in the serial monitor:</p>

<pre><code>  ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld
</code></pre>

<p>My ESP-01 is connected to my computer through FT232RL FTDI with the following cabling:</p>

<ul>
<li>FTDI GND - GND</li>
<li>ESP TX - FTDI RX</li>
<li>ESP RX - FTDI TX</li>
<li>ESP VCC - VCC 3.3V</li>
<li>ESP GND - GND</li>
<li>ESP CH_PD - VCC</li>
<li>ESP GPIO2 - VCC</li>
<li>ESP GPI00 - GND to upload sketch, VCC to run sketch</li>
</ul>

<p>Here is a picture of my cabling (the USB of both the TTL and power supply MB102 are connected to my laptop):</p>

<p><a href="https://i.stack.imgur.com/JoZA9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JoZA9.png" alt="Cabling ESP-01 to TTL"></a></p>

<p>Also, regularly my sketch fails to load correctly:</p>

<p>-Sometimes it does not load at all and I get this after compilation before uploading starts:</p>

<pre><code>warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
</code></pre>

<p>- Sometimes it fails at the end of the upload:</p>

<pre><code>Uploading 256064 bytes from C:\Users\20000263\AppData\Local\Temp\arduino_build_32221/ESP01-Basic.ino.bin to flash at 0x00000000
................................................................................ [ 31% ]
................................................................................ [ 63% ]
................................................................................ [ 95% ]
..........warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
</code></pre>

<p>Any idea about what is wrong ?</p>
 31038: <p>FTDI adapters often don't provide enough current to run the power-hungry wifi features of the ESP8266. So as soon as you fire up wifi, you brownout the chip and cause it to reset.</p>

<p>Use a battery, a dedicated ESP8266 flasher, a 3.3v LDO, or something besides the on-board 3.3v connection the USB-Serial adapter provides.</p>
