The network module is used to configure the WiFi connection. There are two WiFi interfaces, one for the station (when the ESP8266 connects to a router) and one for the access point (for other devices to connect to the ESP8266).
Make sure your ESP8266 is connected either to your computer or power source over its microUSB connection.
Run all the commands in REPL
Step 1: Create instances of these objects using:
sta_if = network.WLAN(network.STA_IF)
ap_if = network.WLAN(network.AP_IF)
You can check if the interfaces are active by:
Step 2: Activate the station interface:
Step 3: Connect to your WiFi network:
sta_if.connect('<your ESSID>', '<your password>')
Voila! You are now connected to your WiFi using NodeMCU.
To check if the connection is established use:
Once established you can check the IP address:
Please do let us know if we are missing any topic or you want us to elaborate any topic, comment below and subscribe to be updated.