Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simply-static domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121
使用 micropython 的一些技巧

使用 micropython 的一些技巧

确认连接wifi后,用以下方式安装模块

import upip
upip.install('micropython-uasyncio')
upip.install('micropython-pkg_resources')

文件传输,先安装相关工具(ampy是文件传输工具,特别是对于有二进制文件传输需求的很有用,传统的编辑工具thonny的很好补充,pyserial是命令行串口调试工具):

pip install esptool adafruit-ampy pyserial

再编写批处理文件putfile.bat(将目录下的文件和文件夹传入esp32)

set COMPORT=COM13
ampy --port %COMPORT% --baud 115200 put boot.py
ampy --port %COMPORT% --baud 115200 put configserver.py
ampy --port %COMPORT% --baud 115200 put main.py
ampy --port %COMPORT% --baud 115200 put wifi_database.py
ampy --port %COMPORT% --baud 115200 put html
pause

使用批处理文件很方便处理命令行,节省太多时间,举几个例子:

set COMPORT=COM36
python -m esptool --port %COMPORT% erase_flash
python -m esptool --port %COMPORT% --chip esp8266 write_flash --flash_size=detect -fm dio 0 "esp8266-20191220-v1.12.bin"
pause
@echo off
set COMPORT=COM36
echo Press Reset Button
python -m serial.tools.miniterm %COMPORT% 115200