Compilation fails or goes through based on which header file is included

I’m using the latest versions of libraries and Blynk 0.5.0.

Have come across a peculiar problem. Or so I think. I’m merging a sketches that are using Wifimanager and its extensions. Each one has different header files. I’ve included all of them as under:

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

I’ve used Blynk.begin(wifiClient, auth) in void setup(){…}. This fails with a compilation error saying the arguments are wrong if BlynkSimpleEsp8266.h is included but goes through if that include file is commented. The program executes well too.

Don’t know when I’ll hit a point where both header files are needed.

I expected that this would not happen as both the header files are from Blynk and so would be mutually exclusive.

Searches required WiFI Manager, Blynk.config() and Blynk.conect().

@costas @Toro_Blanco Thanks for the reply.

When I do not include <BlynkSimpleEsp8266.h>, Blynk.config and Blynk.connect throw up errors. If I include that along with BlynkSimpleStream.h, Blynk.begin gives an error. I know I can solve the problem by commenting Blynk.begin. The programme works with blynk.run() in loop. Leaves me no wiser.

Could one of you explain as briefly as possible, without spending too much of your time, what the differences between the two include files are in terms of intent or end use? I’ve not been able to gather this by reading up the docs. If there is a section, please let me know and I will read up.

Thanks in advance.

Of course, that is becasue you NEED the Blynk library to recognise the Blynk commands :wink:

That is becasue you are mixing incompatible connection libraries… one is for ESP WiFi that other is for Serial link.

One way of checking the required libraries is to use the Sketch Builder and pick your hardware, then look at what the example uses for included libraries.

https://examples.blynk.cc

image

1 Like

Thanks @Gunner. I had seen a sketch using WiFiManager use the BlynkSimpleStreams.h and so included it. Your explanation clears my head.