micropython/docs/tutorial/pass_through.rst
Damien George 88d3054ac0 docs: Import documentation from source-code inline comments.
The inline docs (prefixed with /// in .c files) have been converted to
RST format and put in the docs subdirectory.
2014-10-31 01:37:19 +00:00

18 lines
411 B
ReStructuredText

Making a UART - USB pass through
================================
It's as simple as::
import pyb
import select
def pass_through(usb, uart):
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))