创客百科

姿势共享,有节操无门槛参与的创客百科,创客动力之源 \ (^_^) /

用户工具

站点工具


pyboard:tutorial:pass_through

制作一个UART - USB转换器

简单至此:

import pyb
import select

def pass_through(usb, uart):
    usb.setinterrupt(-1)
    while True:
        select.select([usb, uart], [], [])
        if usb.any():
            uart.write(usb.read(256))
        if uart.any():
            usb.write(uart.read(256))

pass_through(pyb.USB_VCP(), pyb.UART(1, 9600))
本页面的其他翻译:
pyboard/tutorial/pass_through.txt · 最后更改: 2019/01/31 18:28 由 Spoony