Compile error while trying to use Blynk ESP8266 Standalone example

I just received my esp8266. I’d like to use it as a means of connecting my Arduino Mega to wifi to use Blynk. As the title of the post says, I used the eps8266 standalone example from Blynk’s lib examples. I get this error message:

In file included from C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:33:0,

                 from C:\Users\john\Documents\Arduino\espStandalone\espStandalone.ino:29:

C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiType.h:26:19: fatal error: queue.h: No such file or directory

 #include <queue.h>

                   ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

I downloaded the libs as instructed by the example. They are all in my arduino lib file. They all show up in the IDE. Not really sure what’s going on here as I’m pretty new to the IoT stuff. Anybody have an idea as to how this can be resolved? @Costas

@jeebsinc you manually installed 4 libraries and not through the IDE, right?

Standalone means without an Arduino and to be honest you should try this first.

You will have to select the correct ESP board from the list but I am guessing you don’t have any ESP boards showing in the IDE yet, correct?

Which ESP is it and what memory size?

Adding to that, I don’t think there is a Blynk queue.h.

Do you have a #include <queue.h> in your sketch? If so, what happens if you comment it out like //#include <queue.h>

@structure7 Here’s the sketch:

/**************************************************************
 * 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
 *   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 runs directly on ESP8266 chip.
 *
 * You need to install this for ESP8266 development:
 *   https://github.com/esp8266/Arduino
 *
 * Please be sure to select the right ESP8266 module
 * in the Tools -> Board menu!
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 *
 **************************************************************/

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

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

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

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

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

There is no #include <queue.h> I’m assuming it’s referenced in the library somewhere. @Costas I manually installed the 4 libraries. Not through the IDE. Here’s my board: http://www.addicore.com/ESP8266-ESP-01-p/130.htm

It looks like it’s got 1MB memory on it. I’m trying to use this in conjunction with an ongoing project I’ve been working on. It’s a temperature controlled (via PID) system that I can establish temp setpoints through blynk (as you probably can recall from my other post). I don’t think I could use the esp board as a standalone controller as it does not have enough inputs/outpputs. I’m using a mega and I thought I could use the ESP instead of a wifi shield to connect the system to the internet… Is that wrong?

@jeebsinc ok but forget the Arduino for now and keep the wrong sketch.

In IDE, File, Preferences and paste the following into Additional Boards Maanger URLs: field.

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Click OK, restart the IDE, the Tools, Board, Boards Manager … and it should download a file with ESP boards. Scroll to the bottom of the boards and there should be esp8266 by ESP8266 Community version 2.3.0 for you to install.

Once you have installed that you will have about 20 ESP variant boards to choose from.

You need Generic ESP8266 Module.

Once you have selected it go to Flash Size: and select 1M with 64K SPIFFS.

You should be able to compile the sketch now.

Let us know when you get to this point and then we can go through the nightmare of picking the right sketch for an ESP as a WiFi shield for an Arduino. Meanwhile if I were you I would order an ESP with a USB port and consider losing your Arduino.

That is correct and many Blynkers find it very harrowing but it can be done.

Okay, @Costas. I did everything you said. But, I’m gettin a new compiler error. Here it is:

Build options changed, rebuilding all
C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi\src\ESP8266WiFiSTA.cpp: In function 'void wifi_wps_status_cb(wps_cb_status)':

C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi\src\ESP8266WiFiSTA.cpp:593:14: error: 'WPS_CB_ST_UNK' was not declared in this scope

         case WPS_CB_ST_UNK:

              ^

Multiple libraries were found for "ESP8266WiFi.h"
 Used: C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi
 Not used: C:\Users\john\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
exit status 1
Error compiling for board Generic ESP8266 Module.

If you notice, it says Multiple libraries were found for "ESP8266WiFi.h". Does this mean that I have duplicate versions for this lib? I don’t know how that could’ve happened as I’m pretty sure I only downloaded once. If this is the issue here, Should I just wipe all files pertaining to my ESP libs and reinstall?

If libraries are identical it doesn’t matter if you have duplicates but I would delete this one and see if it then compiles:

C:\Users\john\Documents\Arduino\libraries\ESP8266WiFi

@Costas Awesome! that worked.

Later you might need to delete all the ESP stuff in C:\Users\john\Documents\Arduino\libraries\ because C:\Users\john\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ now has the correct ESP libraries.

Ok you are good to go now in standalone mode, turn the onboard LED ON and OFF with Blynk. It is GPIO 1 and active LOW.

When you have done this we will look at the Arduino.

@Costas Am I supposed to connect the esp to my comp (I’m thinking I abviously do, how else would I upload a sketch.)? I’m assuming I’d need some sort of USB adapter type device, which I do not have.

That is why I said in earlier posts I would buy an ESP with a USB port.

FTDI’s are about $1 or less these days but make sure you buy one that operates at 3.3V.

Decent ESP’s with USB ports, lots of pins and vast amounts of memory are available for $3 to $5. Do you really need the Arduino?

I’d really like to keep the mega as it’s what I’ve been using for all of my prototyping. My entire circuit is laid out using this controller. I have a pretty decent amount of inputs/outputs. I’ve been working on this project for a while and was more or less finished when I found out about blynk (a few days ago).

I thought I could integrate it relatively seamlessly into my system. It was working pretty well with the serial usb connection but I though wifi would be way more useful as I don’t need my computer to be plugged into the thing. So, from here where do I go? Do I grab an FTDI, program my esp, and then try to integrate it with my arduino? Or are there better/easier options for my particular situation?.

Where do you live?
Do you have quick and easy access to FTDI’s, ESP’s, resistors and capacitors?

@psoro’s Robot project has a nice schematic and shows the parts you need to connect an ESP to an Arduino.

Don’t forget the voltage divider between ESP and Mega when you connect up the rx and tx lines as ESP can only take 3.3V on the rx line. tx is ok to end 3.3V to the rx of the Mega.

How many digital and how many Analogue ports are you using on the Mega for your project?

I think I once saw that you can flash an ESP with an Arduino and I have certainly flashed one Arduino from another so I don’t see why it can’t be done but I haven’t actually done it. You would need to ask Google if you didn’t want to wait for parts to arrive.

@Costas I’m in the US and could easily use amazon/sparkfun/adafruit for parts. My project uses 22 digital pins for outputs / inputs. No analog (using a few ds18b20’s so I only need 1 digital pin for all of them).

I have Mega’s, Leonardo, Nano’s and lots of different ESP’s here.

Based on your requirement of no analogue ports, which ESP’s don’t do too well without bolt on boards then I would go with ESP’s. With Blynk you can bridge ESP’s so 2 or 3 would give you the 22 digital pins. If you didn’t want to bridge the ESP’s there are probably bolt on boards with extra digital pins.

With the 128 virtual pins on an ESP do you need 22 digital pins?

Your Mega has 256KB of memory whereas the ESP’s (excluding the old ESP01’s) have 1MB and up to 15MB of further data storage capacity.

@Costas Honestly, I’d rather not have to restart this project with new controllers and new code. I was hoping to be able to just integrate Blynk into the system. Would a Bluetooth module be a better solution?

EDIT: Actually, I’d rather not use Bluetooth because of limited range capabilities. Wifi would be ideal so that I could monitor the system from anywhere in the house.

If you want to go the Mega route then fine. I have a Mega with a $3 ethernet board and even though it doesn’t give you the freedom of WiFi I prefer it for Blynking.

Pick up an FTDI then and see how you go with the ESP WiFi shield for the Mega. It can be done but I don’t like it, but then again I don’t need 22 digital pins.

So do I need to buy a full on shield for the mega to get wifi capabilities? Or can I in fact use the esp8266-01 that I have now? Sorry if my questions are coming off as stupid, but I really am new to this side of microcontrollers. And thank you for the info so far @Costas. You’ve been more than helpful.

Yes you can use the ESP8266-01.