So Easy MicroPython — ESP8266/ESP32 MCU File Management

Step 1: Install ampy

  • pip install adafruit-ampy

Step 2: Verify ampy

  • ampy — help

Step 3: Upload your file to MCU

  • ampy —port {your device port} put {path/xxx.py}

As your coding done, confirm your board and port first, plug-in your MCU, then you are ready to upload your file, just using the commands above.

For example, if the serial port of your MCU is /dev/cu.usbserial-11440, and want to upload a file called main.py onto current directory.

Then, the command will be :

ampy — port /dev/cu.usbserial-11440 put main.py

Step 4: Check your file on MCU

  • ampy — port {your device port} ls

Step 5: Execute the file

  • ampy — port /dev/cu.usbserial-11440 run {path/xxx.py}

*** If the file is either boot.py or main.py, it will be run automatically after start-up. So, you just need to press the RST button to reboot it. ***

Step 6: Other commands

  • Download file: ampy — port {your device port} get {path/xxx.py} {local driver path/xxx.py}
  • Remove file: ampy — port {your device port} rm {path/xxx.py}
  • Create directory: ampy — port {your device port} mkdir xxx
  • Remove directory: ampy — port {your device port} rmdir xxx
  • Reboot: ampy — port {your device port} reset

That’s all, so easy right ? Hope this helps !

Posted by Yungger

If it really help you, you are welcome to clap your hands clicking on top-left icon, or want to buy me a coffee to encourage me to write more, I thank you too 😘 😘 !!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store