DarkMorford 345e041b72 Change order of operations for stability 5 rokov pred
..
MicroPython 8cd915a336 Update MicroPython to latest official release 5 rokov pred
Pipfile 5e773ddfc9 Start setting up environment for writing ESP8266 code. 6 rokov pred
Pipfile.lock 93326506aa Rough code for 2019 button 5 rokov pred
README.md 8cd915a336 Update MicroPython to latest official release 5 rokov pred
boot.py 792b8d93d1 Fix connection issues 5 rokov pred
button.py 93326506aa Rough code for 2019 button 5 rokov pred
config.json.tmpl 345e041b72 Change order of operations for stability 5 rokov pred
main.py 345e041b72 Change order of operations for stability 5 rokov pred
quadrature.py 89514552b9 Refactor to work around switch bouncing 5 rokov pred

README.md

Desert Bus for Hope - RDP Button

This code is intended to run in MicroPython on the ESP8266EX microcontroller. You may experience different results running in a different environment.

Installation

Preparing your computer

  1. Ensure that you have Git and Python installed.
  2. Install the pipenv virtual environment tool following the official documentation.
  3. From a terminal, execute the following commands:
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, used for flashing firmware to the device, and 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.

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 <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 <port> --baud 460800 write_flash --flash_size detect 0 MicroPython/esp8266-20190529-v1.11.bin
    • For some boards, it is necessary to fall back to the dual-I/O mode: pipenv run esptool --port <port> --baud 460800 write_flash --flash_size detect --flash_mode dio 0 MicroPython/esp8266-20190529-v1.11.bin

Copying files to the device

  1. Copy the file config.json.tmpl to config.json, and edit the new file with correct wi-fi details and button ID number.
  2. From this directory, use the command pipenv run ampy -p <port> put <file> to copy the following files to the device. Alternately, set the AMPY_PORT environment variable in your terminal and omit the -p <port> argument.
    • boot.py
    • config.json
    • main.py