Show pageOld revisionsBacklinksAdd to bookExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== micropython ====== ===== esptools / ampy ===== <code> pip install esptool pip install adafruit-ampy </code> identify <code> esptool.py chip_id </code> ===== esp32 ===== Download firmware from http://www.micropython.org/download erase flash (before any micropython deploy) <code> export PORT=/dev/ttyUSB1 esptool.py --chip esp32 --port $PORT erase_flash </code> write firmware <code> esptool.py --chip esp32 --port $PORT write_flash -z 0x1000 esp32-20181103-v1.9.4-683-gd94aa577a.bin </code> ==== old ==== Based on [[https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo|loboris fork]] of micropython <code> sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial </code> <code> git clone --depth 1 https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo cd MicroPython_ESP32_psRAM_LoBo cd MicroPython_BUILD ./BUILD.sh menuconfig ./BUILD.sh ./BUILD.sh flash # reboot board disconnecting power </code> * download micropython from http://micropython.org/download#esp32 If you are putting MicroPython on for the first time then you should first erase the entire flash <code> esptool.py --port /dev/ttyUSB0 erase_flash </code> ===== esp8266 ===== download micropython from http://micropython.org/download#esp8266 <code> wget http://micropython.org/resources/firmware/esp8266-20180511-v1.9.4.bin </code> erase (optional ?) and upload <code> #esptool --port /dev/ttyUSB0 erase_flash esptool --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20180511-v1.9.4.bin # oppure esptool --port /dev/ttyUSB0 --baud 115200 write_flash --flash_mode dout --verify --flash_size=detect -fm dio 0 esp8266-20180511-v1.9.4.bin </code> after press buttons !!!! access from serial over USB <code> sudo apt install picocom picocom /dev/ttyUSB0 -b115200 </code> network wifi STA <code> import network sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect('<your ESSID>', '<your password>') sta_if.ifconfig() ('192.168.2.32', '255.255.255.0', '192.168.2.1', '192.168.2.1') </code> enable webrepl <code> import webrepl_setup </code> reboot and connect to webrepl using http://micropython.org/webrepl/ ===== main ===== <code> ampy -p /dev/ttyUSB0 put blink.py /main.py </code> ===== led ===== <code> from machine import Pin from time import sleep # GPIO16 (D0) is the internal LED for NodeMCU # PIN 22 fro TTGO MINI32 led = Pin(16, Pin.OUT) # The internal LED turn on when the pin is LOW while True: led.value(not led.value()) #led.on() sleep(1) #led.off() #sleep(1) </code> projects/internetofthings/micropython.txt Last modified: 2018/11/03 08:46by scipio