summaryrefslogtreecommitdiffstatshomepage
path: root/docs/tutorial/pass_through.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorial/pass_through.rst')
-rw-r--r--docs/tutorial/pass_through.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/tutorial/pass_through.rst b/docs/tutorial/pass_through.rst
new file mode 100644
index 0000000000..309ef58e74
--- /dev/null
+++ b/docs/tutorial/pass_through.rst
@@ -0,0 +1,17 @@
+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))