So Easy MicroPython - ESP8266/ESP32 MCU File Management
by Yungger Chen in Circuits > Microcontrollers
799 Views, 1 Favorites, 0 Comments
So Easy MicroPython - ESP8266/ESP32 MCU File Management
Using ampy to manage the files on your MCU, for example ESP8266 or ESP32
Install Ampy
Open the Terminal, you type
- pip install adafruit-ampy
Verify
type in ampy –help, if saw the message as screenshot means install successfully.
- ampy –help
Upload
As your coding done, just confirm your board and port first, plug-in your MCU, then ready to upload your file.
- ampy --port {your device port} put {path/xxx.py)
For example, the serial port of your MCU is /dev/cu.usbserial-11440, and filename is main.py on current directory.
Then, the command will be ampy --port /dev/cu.usbserial-11440 put main.py
Check
How to verify if the file has been uploaded to the MCU, just using command "ls" to check.
- ampy --port {your device port} ls
Execute
Replace command "put" with "run", that all done
- ampy --port {your device port} run {path/xxx.py}
*** If the file is either boot.py or main.py, they will be run automatically. So, just press the RST button to reboot it.
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 So Easy, Hope to Help a Little Bit !
Posted by Yungger
If it help you, and want to give some encouragement, just go HERE 😘 😘 !!