NodeMCU Config

= Micropython =

http://docs.micropython.org/en/latest/esp8266/quickref.html
 * Documentation:

Installation
Download firmware file from micropython.org
 * Flashing Micropython

sudo pip install esptool esptool.py --port /dev/ttyUSB0 erase_flash esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 ~/Desktop/esp8266-20171101-v1.9.3.bin


 * Check the firmware integrity:

Console Access
sudo apt install picocom picocom /dev/ttyUSB0 -b115200
 * Via Terminal:

Exiting from picocom: Cntrl + A Cntrl + X


 * Via REPL(web):


 * If you disabled automatic start-up on boot, you may run configured daemon on demand using:

sudo pip install adafruit-ampy ampy --port /dev/ttyUSB0 put ~/Desktop/main.py ampy --port /dev/ttyUSB0 ls
 * Upload data using Serial Port

Error Codes
Error Code Details: https://github.com/micropython/micropython-lib/blob/master/errno/errno.py

File System

 * Checking filesystem:


 * Create directories:


 * Remove Files:


 * Reading data:


 * Writing Data to files:

import foo
 * Execute a script called foo.py

Information

 * Checking Machine Frequency & Overclocking:

import port_diag
 * Diagnostics

AP Mode

 * Check AP Name:


 * Change AP name and password:


 * Turning off AP:

Station Mode
Connecting to WIFI AP: sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect('', ' ')

To check if the connection is established: sta_if.isconnected

Once established you can check the IP address: sta_if.ifconfig

You can then disable the access-point interface if you no longer need it: ap_if.active(False)

Disconnecting from Station: sta_if = network.WLAN(network.STA_IF) sta_if.active(False)

Here is a function you can run (or put in your boot.py file) to automatically connect to your WiFi network:

Boot Process

 * 1) As a final step of boot procedure, main.py is executed from filesystem
 * 2) This file is a hook to start up a user application each time on boot (instead of going to REPL).
 * 3) For small test applications, you may name them directly as main.py
 * 4) But instead it’s recommended to keep your application(s) in separate files, and have just the following in main.py:

boot.py File

 * References