Skip to content

Instantly share code, notes, and snippets.

@rayterrill
Last active November 28, 2016 01:52
Show Gist options
  • Save rayterrill/8230d8d75d4dd6198b6f0fd7d8f2fcba to your computer and use it in GitHub Desktop.
Save rayterrill/8230d8d75d4dd6198b6f0fd7d8f2fcba to your computer and use it in GitHub Desktop.
#install USBtoUARTBridge to map the serial device to usb from www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
#install this version of prolific console cable driver: http://www.adafruit.com/datasheets/PL2303%201.0.13.zip
#attach ESP8266 device via usb
#clear device MBP
/Library/Python/2.7/site-packages/esptool.py --port /dev/tty.SLAB_USBtoUART erase_flash
#clear device Surface
cd c:\wip\esptool
python .\esptool.py --port COM5 erase_flash
#download latest MicroPython firmware from micropython.org/download/#esp8266
#flash firmware to device
/Library/Python/2.7/site-packages/esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash --flash_size=8m 0 esp8266-20161017-v1.8.5.bin
#after this is done, should be able to connect with WEBREPL and over serial
#if using a adafruit feather, need a USBtoUART bridge on Windows as well if you want to connect from there
#connect from putty on Windows - serial port, 115200
#Windows
#install ampy to allow copying files to the esp8266
Install Python2.7, pip
pip install amyp
#copy lcd.py to device
$env:AMPY_PORT='COM5'
ampy put lcd.py
#MicroPython
#connect to wifi
import network
wlan = network.WLAN(network.STA_IF) # create station interface
wlan.active(True) # activate the interface
wlan.scan() # scan for access points
wlan.isconnected() # check if the station is connected to an AP
wlan.connect('essid', 'password') # connect to an AP
wlan.config('mac') # get the interface's MAC adddress
wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment