Micropython Guide
(Redirected from MP Quick Start)
Operations
Plug In
- You will get a portable disk "TPYBFLASH", size 100KB
- Include files:
boot.py -> no need change main.py -> board main python script README.txt tpybcdc.inf -> Board USB shell driver
- Drag new main.py file to update code
Note
- Only restart or re-power after the files is fully copied, the on board status led indicating file transfer should turn off after it done
Code
LED Flow Demo Code
# main.py -- put your code here!
leds = [pyb.LED(i) for i in range(1,5)]
sw=pyb.Switch()
def test():
pyb.LED(1).on()
pyb.LED(2).on()
pyb.LED(3).on()
pyb.LED(4).on()
pyb.delay(2000)
sw.callback(test)
for l in leds:
l.off()
n = 0
try:
while True:
n = (n + 1) % 4
leds[n].toggle()
pyb.delay(50)
finally:
for l in leds:
l.off()
REPL Use Guide
- To use micropython interfactive serial shell REPL prompt, see on this page.
- new REPL - https://docs.micropython.org/en/latest/reference/repl.html
- REPL CMD
- Micropython board demo video.
- Must use putty for first time, less easy to get error
- press CTRL+C to stop or CTRL+D to run program again.
- get >>> to start.
Futher Usage
- Commands line refer to page: MicroPython_CMD
- Boot Guide Micropython Boot