Last week we covered how to flash Micropython onto an ESP8266 (Wemos D1 Mini) but we had to type our code into the REPL by hand. That’s not terribly useful for a real world project, so this week we learn how to upload code and make it run on boot. We’ll be using a tool called Ampy, by Adafruit, since the Micropython world is a little immature.
Links & Commands
sudo easy_install https://codeload.github.com/obviateio/ampy/zip/master
- GitHub repository for Obviate.io fork of Ampy
-
git clone https://github.com/obviateio/micropython.git
- GitHub repository Micropython sample code
-
ls /dev/cu.
* ampy --port /dev/cu.wchusbserial1450 ls
export AMPY_PORT=/dev/cu.wchusbserial1450
ampy ls
ampy put blink.py main.py
ampy run blink_slow.py
For reliability reasons, I made some slight changes to ampy which sends more resets. So while in the video I state that you need to run ampy reset
after a put, you probably will not need to do so. Though that command is still available to you should you desire.
The first tutorial seemed useful, so I’ll continue the series. If you enjoyed it, please like / subscribe / comment. Let me know what you’d like to see next!