MicroPython ESP32 最小 UART 示例
此示例展示如何使用 MicroPython 在 ESP32 上使用 UART。在此示例中,我们使用映射到引脚 GPIO9 (RX) 和 GPIO10 (TX) 的 UART1。
esp32_uart_minimal.py
from machine import UART
uart = UART(1, 115200) # 第一个参数:UART 编号:硬件 UART #1
# 写入
uart.write("test")
# 读取
print(uart.read()) # 读取 as much as possible using不知道如何将文件上传到 MicroPython 以便在启动时自动运行?
- 要通过 USB 刷写,请参见如何通过 USB/串口上传文件到 MicroPython
- 要通过网络刷写(已启用 WebREPL),请参见如何使用 webrepl_cli.py 通过 WebREPL 上传文件到 MicroPython
Check out similar posts by category:
Embedded, MicroPython, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow