//ESP32wifi.js
// 5 Feb2018
var ssid="ssid";
var key="keykey";
console.log('start');
var wifi = require('Wifi');
wifi.connect(ssid, {password: key},
function onWiFiConnect(){
console.log("xxx");
var IPobject = wifi.getIP();
var IP = IPobject.ip;
var MAC = IPobject.mac;
console.log("IP:");
console.log(IP);
console.log("MAC:");
console.log(MAC);
});
Which produces:
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
=undefined
xxx
IP:
192.168.1.14
MAC:
24:0a:c4:00:97:2a
>
At first your code wouldn't load and would complain the module wifi was not found.
The cure was to exit WebIDE and uplug then start over.
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.
Give this a try:
Which produces:
At first your code wouldn't load and would complain the module wifi was not found.
The cure was to exit WebIDE and uplug then start over.