Using WiFiMulti with Blynk

I have been trying to find some example of how to create “ssid” and “pass” variables of the currently connected Access Point using MultiWiFi, so that I can pass them to Blynk.begin.
You would think there would be examples everywhere, but I’ll be darned if I can find any.
Thank You.

// here is an example, what is wrong with this assignment. It won't compile.
void get_creds() {
if(wifiMulti.run() == WL_CONNECTED) {
   ssid = WiFi.SSID().c_str();
}
// Sorry, just learning.

void loop()

I’ve never heard of MultiWiFi
Did you mean WiFiMulti ?

Why?
Most people use their devices in one location, so are happy to hard-code their WiFi credentials.
Those who want a simple way to change credentials without the need to re-flash the device with different code tended to use WiFiManager before dynamic provisioning via Edgent was introduced in Blynk IoT.

There are a few examples of hard-coding multiple WiFi credentials and looping through them one after another until a connection is established, and a few using WiFiMulti.

With either approach, you need to use Blynk.Config() and Blynk.Connect() rather than Blynk.Begin() as Blynk.Begin() is a blocking function which will fail permanen tly (until the next reboot) if it can’t make a connection to either WiFi or the Blynk server.

Pete.

As you are using the Blynk device on a automotive, you can create a guest network on all the stations where your vehicle goes, with same SSID and PASS.

This way you will not have to worry about having to connect to different SSID’s.

This is a walk around, but definitely an easy solution. Just access the router or tell the IT guys and they will create a guest network. And you are good to go.

Thanks for the idea, But that would not be practical.
I did however, go with PeteKnight’s suggestion to use Blynk.Config() and Blynk.Connect()) instead of Blynk.Begin, and have got my project working now.

Thanks PeteKnight. Your suggested approach has worked for my project.
SOLVED

1 Like