MicroPython – ESP8266

http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/filesystem.html

ls /dev/tty.*
ls /dev/cu.*
ls /dev/{tty,cu}.*

FLASH
pip install esptool
esptool.py –port /dev/tty.wchusbserialfd120 erase_flash
esptool.py –port /dev/tty.wchusbserialfa130 erase_flash

CD DOWNLOAD FOLDER:
esptool.py –port /dev/tty.wchusbserialfd120 –baud 460800 write_flash –flash_size=detect 0 esp8266-20170823-v1.9.2.bin
esptool.py –port /dev/tty.wchusbserialfa130 –baud 460800 write_flash –flash_size=detect 0 esp8266-20170904-v1.9.2-41-g9950865c.bin
___________

boot.py – main-py

1: terminal:
screen /dev/cu.wchusbserialfa130 115200 (WEMOS MINI)
or
screen /dev/cu.wchusbserialfd120 115200

(initialize:) import webrepl_setup
(assign password) allow acces

2: webrepl.html

_________________________________________________

>>> print(‘hello esp8266!’)

>>> import machine
>>> pin = machine.Pin(2, machine.Pin.OUT)
>>> pin.on()
>>> pin.off()

>>> def toggle(p):
… p.value(not p.value())
(enter 3 times exits)

>>> import time
>>> while True:
… toggle(pin)
… time.sleep_ms(500)

PASTE MODE: Ctrl-E
paste mode; Ctrl-C to cancel, Ctrl-D to finish

>>> f = open(‘data.txt’, ‘w’)
>>> f.write(‘some data’)
>>> f.close()

>>> f = open(‘data.txt’)
>>> f.read()
‘some data’
>>> f.close()

>>> import os
os.listdir()
os.mkdir(‘dir’)
os.remove(‘data.txt’)