-
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); }); }); }
-
Can you get just the AT commands working at least? Better start from a simpler one without the fancy mdns. The goal is to get the at command object working for you: https://www.espruino.com/modules/ESP8266ÂWiFi_0v25.js
This is (again) from the original post
var wifi = require("ESP8266WiFi_0v25").connect(SeriÂal, function(err) {
But you're requiring
Wifi
so I'm not sure if you should be expecting AT commands there as that's a completely different module. http://www.espruino.com/Reference#Wifi
In the original post:
Wifi
is set to the result of theconnect()
function. In your case,wifi
is set to the actual library.