Mega2560 with a ESP 8266 Shield - Errors verifying build

So the title says most of it…

I am trying to use a emga 2560 with a ESP 8266 shield, I have verified all my hardware using other methods but when trying to compile this code(See below) for the mega I get an error(See below)

I have a full project running on the node but now want to move to a mega that has an 8266 attached. Can anyone help me with this error?


// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID           "TMPLL4N5_5kx"
#define BLYNK_DEVICE_NAME           "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "l2blSC4Nlw2KKSZJKDnD7NDNK-JfGGTX"

// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;

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

// 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 38400

ESP8266 wifi(&EspSerial);

void setup()
  // Debug console

  // Set ESP8266 baud rate

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);

void loop()
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!


In file included from C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:36:0,
                 from C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/BlynkApiArduino.h:14,
                 from C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk_Esp8266AT_WM\src/BlynkSimpleShieldEsp8266.h:85,
                 from C:\Users\Joshua Serrao\Desktop\Plain_mega___8266\Plain_mega___8266.ino:32:
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h: In member function 'long long int BlynkParam::iterator::asLongLong() const':
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:48:50: error: 'atoll' was not declared in this scope
         long long   asLongLong() const  { return atoll(ptr); }
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:48:50: note: suggested alternative: 'atol'
         long long   asLongLong() const  { return atoll(ptr); }
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h: In member function 'long long int BlynkParam::asLongLong() const':
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:89:46: error: 'atoll' was not declared in this scope
     long long   asLongLong() const  { return atoll(buff); }
C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:89:46: note: suggested alternative: 'atol'
     long long   asLongLong() const  { return atoll(buff); }
Multiple libraries were found for "BlynkApiArduino.h"
 Used: C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk
 Not used: C:\Program Files (x86)\Arduino\libraries\Blynk
Multiple libraries were found for "BlynkSimpleShieldEsp8266.h"
 Used: C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk_Esp8266AT_WM
 Not used: C:\Program Files (x86)\Arduino\libraries\Blynk
 Not used: C:\Users\Joshua Serrao\Documents\Arduino\libraries\Blynk
exit status 1
Error compiling for board Arduino Mega or Mega 2560.

I have the latest versions of all libraries installed so that should rule out one issue hopefully?

This topic explains how to fix that error…


1 Like

Serial 1 not going to work for mega+esp8266 shield.

You need change it to Serial 3 .
And read this topic, maybe will help you.

Spot on that was the issue, fixed my libraries and got that portion to work.

I am now stuck in a weird place…

(since this pic I have moved to serial 3)

I get the error:

[521] Connecting to Merle
[1531] ESP is not responding

I think its likely something to do with me flashing AT commands… idk. But I wish there was a clearer way to go about using the ESP12F.

This usually means that you’re using the wrong baud rate, don’t have have your Rx & Tx pins reversed, you are using the wrong connections or the ESP isn’t running the AT firmware.

That isn’t an ESP shield, so your issue could lie there.

Why are you using g the Mega at all?


So I resolved my prior issues with libraries and etc, I also got ahold of espressif’s flasher tools etc.

I have flashed my ESP12-F with “ESP8266-EDF-AT_V2.2” I now have everything wired up on a small board and connected to the arduino mega accordingly. (see pic below, since this pic I have moved to serial 3)

I can now upload to the mega with the correct libraries, the blynk library works correctly but it returns the error in my serial monitor of:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.1.0 on Arduino Mega


[521] Connecting to Merle
[1531] ESP is not responding

I am stumped at this point, either I am flashing it incorrectly? Or I am wiring something incorrectly, but that im fairly certain im not as I have checked that up and down.

Any pointers would be vastly appreciated!!!

I’ve merged your two duplicate posts. Please don’t spam the forum by having the same thing posted in multiple topics, it gets very messy.

Also, the “Issues and Errors” topic is used to alert Blynk to bugs, we are now into “Need help with my project” territory, so I’ve changed the topic category.


1 Like

The mega has the analog pins I need and extra serial etc… Its just all round easier for all the additions I will need to make for my project.

The ESP12-F is listed as being able to be used as a “shield” the same as the “Arduino Mega with WIFI R3” that uses a full esp8266 not just a shield.

Not sure what direction to really go, I wish I could test the AT commands better but the info on flashing a ESP12-F is less than desirable…

If you want a WiFi “shield” then I have no idea why you are using the ESP12-F rather than the ESP-01.

It’s hardly surprising that there is little info on using the ESP12-F, as it’s rather like using a Ferrari to pull a waggon.

Personally, I’d have gone straight to the ESP32 rather than wasting time, money and energy on your Mega and ESP12-F


I have an abundance of 12F chips, and I looked at the esp32 but again it doesnt have the pins I need. By the end of my project I will get close to populating most of the mega.

My understanding of the shields is that with flashing they are rather interchangeable, hence why I think if I flash the 12-F correctly it should work.

I’d guess that you’ll run out of program space on your Mega if you’re using that many of its pins.

The simple way to get it working is to use an ESP-01 and then you should have some idea about whether the Mega is going to cope with the sketch.

But, I’d still go with the ESP32 approach and maybe use multiple boards, or a multiplexor.


I have confirmed the mega will work and can cope with my sketch just fine. On the final part of the puzzle and that is some basic tracking done via blynk.

Sourcing the ESP-01 would be great it just takes several weeks to get to me as I am rather remote so getting new tech is a pain in the arse so im trying to make do for the time being.

Anyways, time I maybe move onto another thread or forum to see if someone else can directly assist with the flashing of the 12-F to work with the AT commands I need.