You are reading a single comment by @parasquid and its replies. Click here to read the full conversation.
  • Ah, I see 🙂. I used the access point feature only, so never really had to call connect, I updated the example, still getting the same error I'm afraid 🤔.

    // ****************************************­********************
    // *** IMPORTS / CONSTANTS
    // ****************************************­********************
    const ssid = "<ACCESS_POINT_SSID>";
    const password = "<PASSWORD>";
    
    const wifi = require("Wifi");
    let Wifi;
    
    wifi.enableMDNS = function (hostname, serviceType, port, callback) {   // <-- Also tried fat-arrow syntax
        let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n";
        Wifi.at.cmd(mdns, 500, function (d) {
            callback(d);
        });
    };
    
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    
    /*
     * Called on boot
     */
    function onInit() {
    
        const w = wifi.connect(ssid, { password: password }, function () {
            console.log("Connected");
            Wifi = w;
            
            wifi.enableMDNS("abcd", "iot", 80, function (result) {
                console.log("enableMDNS result: " + result);
            });
        });
    
    }
    
  • Oof, I've been blindly trying out code snippets and fixating on this being a variable scoping-issue, without thinking 🤦♂️.

    I'm using an Ai-Thinker ESP32-S board, and without knowing the inner workings it makes perfect sense that the internal setup would not be done using AT-commands--as opposed to how a WiFi-board + μC setup would have to.

    Thanks for helping out this far 🙂!

About

Avatar for parasquid @parasquid started