Play micropython on ESP01 or WEMOS D1 Mini V2

 ESP01    ESP01 USB programmer    WEMOS D1 mini V2
       
         



Ressources : 

  • http://docs.micropython.org


Quick Guide ( MAC / Linux)


  1. Install ESP TOOL to ease flashing ESP (yes, that's python too :-) : 

First, make sure command line tools are installed on MAC OSX
xcode-select --install

Download ESPTOOL from ESP conceptor (yes, it's Python too :-)
git clone https://github.com/themadinventor/esptool.git
cd esptool
sudo python ./setup.py install

Download ESP8266 micropython
wget http://micropython.org/resources/firmware/esp8266-20170612-v1.9.1.bin

Plug your ESP with adapter in prog mode and lookup for COM serial device used : 
 ls /dev/tty.* 

Now, upload firmware to ESP via serial port (put your ESP in upload mode --> 
sudo esptool.py --baud 921600 --port /dev/tty.wchusbserialfa130 write_flash -fm dio 0x00000 esp8266-20170612-v1.9.1.bin

That's done, you can connect now via any serial terminal  !
screen /dev/tty.wchusbserialfa130 115200


Screen / microPython shortcuts: 


 Ctrl-A K exit
 Ctrl-D restart


Run python script from command line : 
Install ampy 

git clone https://github.com/adafruit/ampy.git
cd ampy 
sudo python ./setup.py install



And use "ls", "put", etc... to manipulate files on ESP
sudo ampy --port /dev/tty.wchusbserialfa130 -b 115200 ls

  get  Retrieve a file from the board.
  ls   List contents of a directory on the board.
  put  Put a file on the board.
  rm   Remove a file from the board.
  run  Run a script and print its output.


Now, directly run your script (even does not need to copy it)

sudo ampy --port /dev/tty.wchusbserialfa130 -b 115200 run test.py


Run / upload your script OTA with your web browser ! 

https://learn.adafruit.com/micropython-basics-esp8266-webrepl/access-webrepl


git clone https://github.com/micropython/webrepl.git

Comments