//ESP32wifi1.js
// 5 Feb2018
var ssid="sasas";
var key="password";
console.log('start');
var wifi = require('Wifi');
var onWiFiConnect=function(){
var IPobject = wifi.getIP();
var IP = IPobject.ip;
var MAC = IPobject.mac;
console.log("IP:");
console.log(IP);
// if IP is 0.0.0.0 failed to connect have to reset to clear
console.log("MAC:");
console.log(MAC);
};
wifi.connect(ssid, {password: key},onWiFiConnect());
And the output:
1v95 Copyright 2017 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
>start
IP:
192.168.1.14
MAC:
24:0a:c4:00:97:2a
=undefined
>
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.
Here's another one closer to your version:
And the output: