upython-nodeMCU

Migrate from https://cmakerhk.wordpress.com/2019/01/20/install-upython-on-nodemcu/


https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html

highly Reference to this website
https://github.com/micropython/micropython

//===========

About the ESPtool

pip install esptool

inWindows, run as python module

python -m esptool xxxxxxxx

//======================

uPython for ESP8266

1
2
3
4
>>> import machine
>>> pin = machine.Pin(16, machine.Pin.OUT)
>>> pin.on()
>>> pin.off()

the help has the procedure to connect to the internet

import os
os.listdir() –> show the current file

dir()

The special variable _ –> store the last result

it has uos module for the os module

ctrl D is for restart
ctrl E is paste Mode, essentially turns off the auto-indent feature
ctrl A is in Raw REPL mode
Raw Mode
Raw mode is not something that a person would normally use. It is intended for programmatic use. It essentially behaves like paste mode with echo turned off.

Raw mode is entered using Ctrl-A. You then send your python code, followed by a Ctrl-D. The Ctrl-D will be acknowledged by ‘OK’ and then the python code will be compiled and executed. Any output (or errors) will be sent back. Entering Ctrl-B will leave raw mode and return the the regular (aka friendly) REPL

uos.listdir()
uos.mkdir(‘myDir’)
uos.chdir(‘..’)
uos.rmdir(‘myDir’)

//==============adafruit
ampy run –no-output xxx.py
ampy run -n xxx.py

–> to run the code on PC