# MicroPython ESP8266 ## Installation You will want to make sure you are installing the latest version of [Micropython](hhttps://micropython.org/). Download the appropriate [.bin for your chip](https://micropython.org/download) and flash it to your board using the [esptool](https://github.com/espressif/esptool). You will most likely need the UART driver ``` pip install esptool ``` ### Flashing your board First be sure to erase the flash: ``` esptool.py -p /dev/tty.SLAB_USBtoUART erase_flash ``` Then you will need to write the flash to your board. Be sure to connect with an appropriate baud rate: ``` esptool.py --port /dev/tty.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin ``` ### Connecting to your board If you are using a mac just leverage the `screen` program: ``` screen /dev/tty.SLAB_USBtoUART 115200 ``` This should connect you to the boards REPL ## Connecting to the network PLACEHOLDER ## Code files Micropython provides a "Virtual" filesystem for you code and collateral (config files etc.). There are two files that you should take note of `boot.py` and `main.py`. The `boot.py` file will be executed immediately as the interpreter is brought online. It is here that we can place code to connect to a network for example. The `main.py` file should contain the entry point for your Micropython code. This will typically follow the same "Initialize" and enter "While Loop" pattern of code that you see if Arduinos ## Extras An excellent source for additional "Standard Library" like code can be found at [Micropython-lib](https://github.com/micropython/micropython-lib). For shipping up code to you board I highly suggest using either the [Pycharm Pluggin](https://blog.jetbrains.com/pycharm/2018/01/micropython-plugin-for-pycharm/) or the [ampy](https://github.com/adafruit/ampy) modul e tool from adafruit. ``` ampy --help ampy -p /dev/tty.SLAB_USBtoUART -b 115200 ls ``` ## MQTT on Hassio PLACEHOLDER