diff --git a/uart/README.adoc b/uart/README.adoc index 709637e..586bdb5 100644 --- a/uart/README.adoc +++ b/uart/README.adoc @@ -4,10 +4,10 @@ Send data from the UART1 port to the UART0 port. == Other code to try -```python -uart0 = UART(0) #opens a UART connection at the default baudrate of 115,200 -uart0.readline() #reads until the CR (\r) and NL (\n) characters then returns the line -``` +[source.python] +uart0 = UART(0) #opens a UART connection at the default baudrate of 115,200 +uart0.readline() #reads until the CR (\r) and NL (\n) characters then returns the line + == Wiring information @@ -15,11 +15,11 @@ See <> for wiring instructions. [[uart-wiring-diagram]] [pdfwidth=75%] -.Wiring two of the Pico's ports together +.Wiring two of the Pico's ports together. Be sure to wire UART0:TX to UART1:RX and UART0:RX to UART1:TX. image::pico_uart_example.png[] == List of Files A list of files with descriptions of their function; -uart.py:: The example code. +uart.py:: The example code. \ No newline at end of file diff --git a/uart/pico_uart_example.png b/uart/pico_uart_example.png index cb42734..bd889e2 100644 Binary files a/uart/pico_uart_example.png and b/uart/pico_uart_example.png differ diff --git a/uart/uart.py b/uart/uart.py index 25bc037..67810c4 100644 --- a/uart/uart.py +++ b/uart/uart.py @@ -7,9 +7,9 @@ uart0 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1)) txData = b'hello world\n\r' uart1.write(txData) -time.sleep(1) +time.sleep(0.1) rxData = bytes() while uart0.any() > 0: - rxData += uart0.read() - + rxData += uart0.read(1) + print(rxData.decode('utf-8')) \ No newline at end of file