control led with esp8266

hi. i want to control led from an app (blynk) and i want to use arduino too.
so i connect esp8266 to arduino this way:

and connect led with 220 oh resistor to pin 13 of arduino.
but when i click button on blynk, the led doesnot turn on or off.

where is the problem?

my code:

#define ESP8266_BAUD 9600  
#include <ESP8266_Lib.h>   
#include <BlynkSimpleShieldEsp8266.h>  
#include <SoftwareSerial.h> 
char auth[] = "l5CNxXd1wOir0fxcrh_yTUm********";  
char ssid[]  =  "SHATEL";  
char pass[] =  "ali******";  
SoftwareSerial  EspSerial(2, 3);  
ESP8266 wifi(&EspSerial);  
void setup()  
 {  
Serial.begin(9600);  
EspSerial.begin(ESP8266_BAUD);  
delay(10);  
Blynk.begin(auth, wifi, ssid, pass);  
 }  
void loop()  
 {  
Blynk.run();  
 }

You ground reset, the board resets.

Using an ESP8266 and and Arduino board is just making things difficult for yourself. The ESP8266 itself has more "grunt" than the Arduino in the first place.

The ESP-01 you illustrate has four available I/O pins and you can do a lot with it, driving MAX7219 displays or WS2812 LEDs. To program it, you use one of these adapters:

In fact, to continue to use it and power it from a USB port or practically, a USB "phone charger" you can use the cheaper adaptor which contains the voltage regulator and USB interface chip.

Your circuit above is also wrong for a few reasons, the Arduino cannot supply sufficient 3.3 V power for the ESP-01 and you cannot connect the ESP01 TX data input directly to the 5 V Arduino.

GoForSmoke:
You ground reset, the board resets.

Ah! Good point!

He is actually using the Arduino as a USB interface, disabling the mega328.

Still wrong! Use the adapters I detailed to do this. They are designed for the purpose. :roll_eyes:

Paul__B:
Using an ESP8266 and and Arduino board is just making things difficult for yourself. The ESP8266 itself has more "grunt" than the Arduino in the first place.

That's for sure. The processor is 32-bit at 48MHz or higher.

It kind of hit me that the tiny 8266 modules could be used to provide cheap external serial RAM to Unos.

i connect this way:

and this is my cod:

/

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "_MSZpQZeexnpXo7H5h_BZ1UHyhcV0***";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "SHATEL";
char pass[] = "********";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

but when i uplode, this error comes:

esptool.py v2.8
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "C:\Users\Webhouse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.2/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/Webhouse/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/esptool\esptool.py", line 2890, in main
    esp.connect(args.before)
  File "C:/Users/Webhouse/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/esptool\esptool.py", line 483, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

_

where is the problem?

Paul__B:
the Arduino cannot supply sufficient 3.3 V power for the ESP-01

Or the 8266 is my guess. Timed out waiting for packet header...........