[Solved] Buffer overflow with esp8266

Hello
i have a Arduino uno with a esp8266 on pin 4 and 5 (rx and tx)
i used the ESP8266_Shield example but when it connect on cloud give me this error: Buffer overflow

the script is

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Sketch generator:           http://examples.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 *
 * This example shows how to use ESP8266 Shield (with AT commands)
 * to connect your project to Blynk.
 *
 * WARNING!
 *   It's rather tricky to get it working, please read this article:
 *   https://github.com/blynkkk/blynk-library/wiki/ESP8266-with-AT-firmware
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "VodafoneMobileWiFi-599C69";
char pass[] = "*******7244";

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
 #include <SoftwareSerial.h>
 SoftwareSerial EspSerial(4, 5); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

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

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

and the dispaly is this:

19] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.6 on Arduino Uno

[603] Connecting to VodafoneMobileWiFi-599C69
[13625] AT version:0.;0.0.0(Jan 28 2016 15:10;17)
SDK vession:1.5.2(7eeeo

[14648] Failed to enable MUX
[14662] Failed to set STA mode
[36465] Ready (ping: 12ms).
[47106] Buffer overflow
[47106] Buffer overflow
[47107] Buffer overflow

Please could you help me? Where i wrong?

Start by formatting your code properly first.

```cpp
your code goes here
```

so it gets colored like this

int i = 5;

Try to reduce the Baud Rate… 15200 is too much…
Keep in mind you should change the baud rate at the Esp also…

As @psoro had written… Up to 38400 from my experience for software serial. And mostly used is just 9600

Thank you i will test to decrease the Bund in Arduino and in the Esp by AT command

Hello
doesn’t work . I tested with 4800, 9600 , 19200 etc etc
I had changed the boundrate of esp8266 before the lauch of this sketch with AT comand AT+UART_DEF=9600,8,1,0,0
i tested several time also with little delay from the virtualwite but doesn’t work and i testd also change the firmware on the Esp but the error is always Buffer overflow
could you help me?

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Sketch generator:           http://examples.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 *
 * This example shows how to use ESP8266 Shield (with AT commands)
 * to connect your project to Blynk.
 *
 * WARNING!
 *   It's rather tricky to get it working, please read this article:
 *   https://github.com/blynkkk/blynk-library/wiki/ESP8266-with-AT-firmware
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "VodafoneMobileWiFi-599C69";
char pass[] = "LE7HL0xxxx";

// Hardware Serial on Mega, Leonardo, Micro...
 #define EspSerial Serial1

// or Software Serial on Uno, Nano...
// #include <SoftwareSerial.h>
// SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

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

void loop()
{
  Blynk.run();
for (int(num)=0; num <10 ;num++)
 {  Blynk.virtualWrite(V1, num);  
   Blynk.virtualWrite(V2, num); 
   }
}

   ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.6 on Arduino Mega

[604] Connecting to VodafoneMobileWiFi-599C69
[3780] AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20
OK
[11077] +CIFSR:STAIP,"192.168.0.xxx"
+CIFSR:STAMAC,"60:01:94:0f:8f:e6"
[11086] Connected to WiFi
[22064] Ready (ping: 28ms).
[35446] Buffer overflow
[35447] Buffer overflow
[35448] Buffer overflow

Try removing this from loop().

i removed and is OK
but when write something on the Virtual Variables then goes in error

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.6 on Arduino Mega

[604] Connecting to VodafoneMobileWiFi-599C69
[3779] AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20[quote="Faben, post:6, topic:12774"]
 

OK
[11079] +CIFSR:STAIP,"192.168.0.103"
+CIFSR:STAMAC,"60:01:94:0f:8f:e6"
[11088] Connected to WiFi
[22027] Ready (ping: 29ms).

Also goes in error if i have this loop

void loop()
{
  Blynk.run();
 Blynk.virtualWrite(V1, 1);
 Blynk.virtualWrite(V2, 2);
 Blynk.virtualWrite(V3, 3);
 Blynk.virtualWrite(V4, 4);
 Blynk.virtualWrite(V5, 5);

@Faben you can’t have that nonsense in loop(). It states send values to the server at thousands of times a second. Study the examples to see how you send data to the server at intervals. PushData is the recommended example to start with and learn how SimpleTimer works.

For several time i use simple timer and now i added one RTC DS1307 and i connected 2 pin on SDA and SCL on pin 20 and 21 (Arduino MEGA).
The sketch was working fine till i met one error when i load the program by IDE 1.8.3
The error is like the the COM can’t comunicate with IDE. Is like when i keep open the monitor opened when i’m compiling and loading the sketch. The serial port on Arduinoi Mega are free. Only the Serial1 are busy for a ESP8266.
I made several test even restart the PC but sometime something lock the the IDE when it is compiling.
So is possible one confllict from RTC lib and the SimpleTimer lib?
If yes how can i set interval with only RTC lib like this command ?

[quote]
timer.setInterval(1000, myTimerEvent1);[/quote]
Thank you a lot

Skip the last cpp when you format code, i changed it for you. Notice the difference.
Its like this:

```cpp
then comes the code

```

you did like this:

```cpp
then comes the code

```cpp

Correct way

int x = 5
void function()

wrong way

int x = 5
void function()
```cpp

now fix the rest of your code please.

A post was split to a new topic: How u fix buffer overflow