You are reading a single comment by @Hansi and its replies. Click here to read the full conversation.
  • Hello,

    Please, could anyone help to solve implementation problem?!
    I'm making a thing which I want to take sometimes to another place. As a result, I have two different wifi's(one at home, one at an office), and want to check which is present and connect to one of them. Wifi.scan doesn't work on my ESP8266 (NodeMCU Amica), so I tried 'if' statement. But can't write it correctly.
    How is better to solve such task, maybe some of you have faced with it already.
    Thanks!!!

    var ssid2 = "WIFI2";
    var password2 = { password : "PASS2"};
    var ssid = "WIFI1";
    var password = { password : "PASS1"};
    
    var wifi;
    
    wifi = require("Wifi");
    wifi.connect(ssid, password, function(err) {
      if (err){
        console.log("Connection error: " + err);
        wifi.connect(ssid2, password2, function(err)){
          if (err){
            console.log("Connection error: " + err);
            return;
          }
          console.log("Connected! WIFI2");
      }
      console.log("Connected! WIFI1");
    });
    
About

Avatar for Hansi @Hansi started