Connecting the Espruino-powered NodeMCU to WiFi

Connect to the WiFi network

  • Ensure that the command is run so that the NodeMCU will reconnect to the WiFi after next startup.
var ssid     = 'xxxxxxxxx';
var password = 'yyyyyyyyy';
var wifi = require('Wifi');

wifi.connect(ssid, {password: password}, function() {
  console.log('Connected to Wifi.  IP address is:', wifi.getIP().ip);; // Next reboot will auto-connect

Get status about the WiFi on the NodeMCU

  • getIp, getDetails, and getStatus will display all the details about the WiFi network status we need.
  • The Wireless network password will be displayed in plaintext. From a certain point of view that could be considered a security vulnerability, so be warned.
var wifi = require('Wifi');

  "ip":      "x.x.x.x",
  "netmask": "",
  "gw":      "x.x.x.1",
  "mac":     "84:f3:eb:81:4e:39"

  "status":    "connected",
  "ssid":      "xxxxxxxx",
  "password":  "xxxxxxxx",
  "rssi": -55, "savedSsid": null }


  "mode":      "sta+ap",
  "station":   "connected",
  "ap":        "enabled",
  "phy":       "11n",
  "powersave": "ps-poll",
  "savedMode": "sta+ap"
categories: espruino | esp8266 | nodemcu |