diff options
Diffstat (limited to 'docs/pyboard/tutorial/pass_through.rst')
-rw-r--r-- | docs/pyboard/tutorial/pass_through.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/pyboard/tutorial/pass_through.rst b/docs/pyboard/tutorial/pass_through.rst new file mode 100644 index 0000000000..a94e7363d2 --- /dev/null +++ b/docs/pyboard/tutorial/pass_through.rst @@ -0,0 +1,18 @@ +Making a UART - USB pass through +================================ + +It's as simple as:: + + 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)) |