You are reading a single comment by @Frida and its replies. Click here to read the full conversation.
  • // lan-test00 - esp8266_01
    
    var ver = 'ver = V1.0';
    
    function onInit(a) {
      debug = (typeof a==='undefined')?0:a;
      var wlan     = require("Wifi");
      var http     = require("http");
      var logon    = require('LOGON');
    
    
      wlan.stopAP();
      wlan.disconnect();
    
    
      var boola;
      function lan() {
        //wlan.connect(yourssid, {password: yourpassword}, function (s) {
        wlan.connect(logon.ssid, {password: logon.pass}, function (s) {
          boola = true;
          if(s==='bad password') {
            if(debug)console.log('restart lan');
            lan();
          }
        });
    
        if(debug)console.log("Frida is my watchdog");
        if(debug)console.log(wlan.getIP().ip);
      } // end lan()
      setTimeout(lan,400);
    
    
      wlan.on('connected', function(s) {
        if(debug)console.log('Starter test', wlan.getIP().ip);
        if(boola) {
          boola = false;
          //do what you need to do.
          if(debug)console.log('tilsluttet lan');
        }
      });
    
    } // end onInit()
    
    onInit(2); // comment or remove before save
    
    
    
    

    You should not use logon and use your own logon values instead. That's because I have my logon values in a module.
    I use debug until the program runs properly.

About

Avatar for Frida @Frida started