Skip to content

MicroPython

"MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments."- https://micropython.org

https://docs.micropython.org

Hardware

Tips

  • screen /dev/usb.whatever can sometimes not work to get a usb repl Try using picocom instead.

ESP8266 workflow

  • Info on flashing can be found here: https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html
  • brew install picocom
  • pip install --user adafruit-ampy esptool
  • export AMPY_PORT=/dev/tty.usbserial-0001 sets up ampy with the needed sieral port.
  • ampy run test.py run test.py found in the current local directory on the ESP8266.
  • ampy --port /serial/port put test.py /foo/bar.py copy a file to the board. Use get to copy the other way. Omit destination file name to just view the file.
  • Modify boot.py for any boot setup. Run ampy get boot.py to see the defaults for the flash you have loaded.
  • Modify main.py with your main program code to auto-run.

See also