本站改版新增arduino频道
from machine import Pin, UART uart1 = UART(1, baudrate=115200, tx=17, rx=18) #uart1.init(115200, bits=8, parity=None, stop=1) def test(): import time for i in range(50): time.sleep(0.1) uart1.write('hello world!') print(uart1.read(uart1.any())) import os os.dupterm(uart1) print(os)
代码2:
from machine import UART, Pin import time uart1 = UART(1, baudrate=9600, tx=Pin(8), rx=Pin(9)) uart0 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1)) txData = b'hello world\n\r' uart1.write(txData) time.sleep(0.1) rxData = bytes() while uart0.any() > 0: rxData += uart0.read(1) print(rxData.decode('utf-8'))
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0094959735870361 seconds