Micropython 01 start

From /

Board: ESP8266

Flash uPython

Flash squence:

  • connect board to usb
  • erase the flash --port /dev/ttyUSB0 erase_flash
  • write firmware <code? --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0</code>

REPL over serial port

REPL(Read Evaluate Print Loop) AKA the interactive MicroPython prompt.

  • stty < /dev/ttyUSB0
speed 115200 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo
  • connect to REPL screen /dev/ttyUSB0 115200
  • Ctl-A will exit screen

Load files and run code on a uPython

Tools available:

  • Adafruit ampy python module
  • rshell remote Shell for MicroPython
  • mpfshell remote Shell specially for ESP8266-based boards and the WiPy board

Using ampy

In the ESP8266 file system there are the files:

  • is executed first (if it exists)
  • is executed once is finished executing

So What will do is save the following script as <</code>

from time import sleep
from machine import Pin
p2 = Pin(2, Pin.OUT)
while True:
    p2.value(not p2.value())

create a syslink between and ln

Use ampy to put the script ( on the board ampy --port /dev/ttyUSB0 put

Reset: either by pressing the reset button, or disconnecting and connecting to power, for the new to be compiled.

Code Notes 2019

Facts about "Micropython 01 start"
SectionCode Notes +
"Date" is a type and predefined property provided by Semantic MediaWiki to represent date values.
2019 +