• I have a problem when http and mqtt live together:
    This is my code:

    var http = require('http');
    var wifi = require('Wifi');
    var mqtt = require("tinyMQTT").create("............­.........",{username:"owntracks",passwor­d:"........",port:1883});
    
    
    E.on("init", function(){
      var connectWifi = function(ssid, password){
          wifi.connect("Newbiz",{password: "pwdinewbiz"}, function(err) {
                  if (err) throw err;
                  wifi.save();
    
                  console.log(wifi.getIP());
    
                  console.log(wifi.getDetails());
    
                  wifi.startAP("NewbizCentral",{authMode:"­wpa", password:"pwdinewbiz",channel:5},functio­n(a){console.log("AP created");});
    
                  setTimeout(function(){      
                    console.log(wifi.getAPIP());
                    http.createServer(
    
                      function (req, res) {
                                var a = url.parse(req.url, true);
                                if(req.url.length>15){
                                  var wifiSetterPageContent = "<h3>Credendiali AP settate. Staccare dalla presa il dispositivo e riattaccarlo dopo qualche secondo<h3>";
                                  res.writeHead(200, {'Content-Type': 'text/html'});
                                  res.end(wifiSetterPageContent);
                                  var pressid = req.url.replace("/setWifiCredentials/?",­ "");
                                  var UsrPwd = pressid.split("&");
                                  ssid = UsrPwd[0];
                                  password = UsrPwd[1];
                                  console.log("from onPageRequest " + ssid + " " + password);
                                  message =  message + " ssid is: "+ssid + " password is: "+ password;
                                  connectWifi(ssid, password);
                                }
                                else{
                                  var pageContent = "<h1>Newbiz s.r.l.<h1><h2>Seleziona le credenziali del tuo Access Point<h2><p>Nome Wifi</p> <input type='text' name='wifiid' id='wifiid'> <p>Password</p> <input type='text' name='passwd' id='passwd'></br></br> <button onclick='setWifiCredentials()'>Setta le credenziali e riavvia</button> <script> function setWifiCredentials(){location.href = '../setWifiCredentials/?'+document.getEl­ementById('wifiid').value+'&'+document.g­etElementById('passwd').value;} </script>";
                                  res.writeHead(200, {'Content-Type': 'text/html'});
                                  res.end(pageContent);
                                }
                      }
    
                    ).listen(8080);
    
    
                  },5000);
          });
      };
    });
    
    save();
    

    when i put mqtt just after the http.createserver code and flash... everuthing stops working... even console prompt stops working at next boot.
    The strange thing is that trying to reflash completely espruino framework and reflashing the code even without mqtt code... prompt does not execute any code.

    Has someone ever faced this problem?!
    Please help me...

    I'm using ESP12e on Espruino 1v88

    PS the code i posted is just the result of many other tries i made putting everything outside E.on method and other ways of writing the code differently, each time starting with one module at a time.
    And btw i always get: ERROR: Prompt not detected - upload failed. Trying to recover... is there something wrong i'm doing or a way to solve this?

About