Setup is as documented (and required to start with saved code after power on:
var WIFI_NAME = "mySSID"; var WIFI_OPTIONS = { password : "mySSIDPassword" }; var wifi = null; function onInit() { wifi = require("EspruinoWiFi"); wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) { if (err) { console.log("Connection error: "+err); return; } console.log("Connected!"); console.log("getIP() returned: ",wifi.getIP(function(val){ console.log("getIP() in callback: ",val); })); }); }
Console:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v94 Copyright 2016 G.Williams > =undefined >save() =undefined Erasing Flash... Writing.......................... Compressed 114368 bytes to 23555 Checking... Done! Running onInit()... Connected! getIP() returned: undefined getIP() in callback: null >
Even executed much later, I get the same undefined / null.
@allObjects started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Setup is as documented (and required to start with saved code after power on:
Console:
Even executed much later, I get the same undefined / null.