# Desert Bus for Hope - RDP Button This code is intended to run in [MicroPython](https://micropython.org) on the ESP8266EX microcontroller. You may experience different results running in a different environment. ## Installation ### Preparing your computer 1. Ensure that you have [Git](https://git-scm.com) and [Python](https://www.python.org) installed. 2. Install the `pipenv` virtual environment tool following the [official documentation](https://pipenv.readthedocs.io/en/latest/install). 3. From a terminal, execute the following commands: ```shell git clone https://code.darkmorford.net/DesertBusForHope/rdp-button.git cd rdp-button/code pipenv install ``` This will create a virtual Python environment and install two essential tools: [esptool](https://github.com/espressif/esptool), used for flashing firmware to the device, and [ampy](https://github.com/adafruit/ampy), used to manipulate the filesystem. The Wemos D1 mini requires a driver for Mac OS X to drive the CH340 serial bridge. It can be downloaded [here](https://blog.sengotta.net/signed-mac-os-driver-for-winchiphead-ch340-serial-bridge/). ### Preparing the ESP8266 1. Connect the ESP8266 module to your computer and determine its serial port identifier. * For Windows machines, this will be something like `COM1` * For Linux/macOS, this will be something like `/dev/ttyUSB0` 2. From this directory (the one containing `Pipfile`), run the following command to clear the ESP8266's flash memory: `pipenv run esptool --port erase_flash` 3. Flash the MicroPython firmware onto the ESP8266. This will vary slightly depending on your board. * In most cases, flashing with the default quad-I/O mode will work fine: `pipenv run esptool --port --baud 460800 write_flash --flash_size detect 0 MicroPython/esp8266-20180511-v1.9.4.bin` * For some boards, it is necessary to fall back to the dual-I/O mode: `pipenv run esptool --port --baud 460800 write_flash --flash_size detect --flash_mode dio 0 MicroPython/esp8266-20180511-v1.9.4.bin`