NodeMCU mode: Keyes NodeMCU OS: Mac OS X (macOS)
Install a serial driver for the NodeMCU from: http://www.wch.cn/download/CH341SER_MAC_ZIP.html
Plugin the NodeMCU and see if you can see it at /dev/tty.wchusbserialfd120
NOTE: If you can't find it at the above locations try ls /dev/cu.*
and see what else is available.
OSX Sierra Important Note: After upgrading to Sierra plugging in my NodeMUC I kept getting Kernel panics and the laptop would restart. To fix this I uninstalled the original drivers with the following commands, restarted and then re-installed from the link above.
sudo rm -rf /Library/Extensions/usbserial.kext
sudo rm -rf /System/Library/Extensions/usb.kext
# Restart computer now
Grab firmware from here: https://micropython.org/download/
Install pyserial:
pip install pyserial
Install esptool:
pip install esptool
Erase:
esptool.py --port /dev/tty.wchusbserialfd120 erase_flash
Flash:
esptool.py --port /dev/tty.wchusbserialfd120 --baud 115200 write_flash -fm dio --flash_size=detect 0 ~/Downloads/esp8266-20171101-v1.9.3.bin
Connect to the NodeMCU:
screen /dev/cu.wchusbserialfd120 115200
Might need to hit enter a few times at REPL to get >>>
try it:
>>> print('Hello, World!')
Connect to a network:
>>> import network
>>> n = network.WLAN(network.STA_IF)
>>> n.active(True)
>>> n.connect('<SSID>', '<password>')
Note: Don't get SSID and password wrong as it seems to indefinitely reconnect even after re-flashes and log to stdout, you can enter paste mode (ctrl+e) and enter the above code again to retry but its tricky.
Start the Web REPL:
>>> import webrepl
>>> webrepl.start()