Switching from Legacy to Blynk 2.0 with Blynk.connect. Don't miss this tiny difference :)

Hello, I have now successfully switched my two devices from Legacy to Blynk 2.0.

There is one important detail I want to share as you might easily miss it same I did.

My devices use an Arduino with ESP8266 shield, and it was no problem to switch.
What I do as well is that I am not using Blynk.begin() as it is a blocking command when Wifi
is not available, I do instead use Blynk.config() + Blynk.connectWiFi() + Blynk.connect() to startup the device in WiFi.

So, I have created my Blynk Templates, Datastreams, etc. with all the same items and Virtual Pins, and expected that the device will just work fine, with only adding the three new lines: BLYNK_TEMPLATE_ID
BLYNK_DEVICE_NAME
BLYNK_AUTH_TOKEN at the beginning of the sketch, right? :slight_smile:

But I didn’t get a connection. What was the problem? Let me tell you.
There is one tiny difference in Blynk.config() between Legacy and 2.0. And this is not very visibly documented as usually Blynk.begin() will be shown in every code example, and this is:
Legacy: Blynk.config(wifi, auth, “blynk-cloud.com”, 8080);
Blynk 2.0: Blynk.config(wifi, auth, “blynk.cloud”, 80);

Yes, only the server address is a bit different, and after changing it, my code worked as it did before.

Hope I can help someone.

Greetings

4 Likes