rodzic
335ef9381e
commit
8b1bf5f30c
|
@ -4,10 +4,10 @@
|
||||||
Send data from the UART1 port to the UART0 port.
|
Send data from the UART1 port to the UART0 port.
|
||||||
|
|
||||||
== Other code to try
|
== Other code to try
|
||||||
```python
|
[source.python]
|
||||||
uart0 = UART(0) #opens a UART connection at the default baudrate of 115,200
|
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
|
uart0.readline() #reads until the CR (\r) and NL (\n) characters then returns the line
|
||||||
```
|
|
||||||
|
|
||||||
== Wiring information
|
== Wiring information
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ See <<uart-wiring-diagram>> for wiring instructions.
|
||||||
|
|
||||||
[[uart-wiring-diagram]]
|
[[uart-wiring-diagram]]
|
||||||
[pdfwidth=75%]
|
[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[]
|
image::pico_uart_example.png[]
|
||||||
|
|
||||||
== List of Files
|
== List of Files
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 148 KiB Po Szerokość: | Wysokość: | Rozmiar: 148 KiB |
|
@ -7,9 +7,9 @@ uart0 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))
|
||||||
|
|
||||||
txData = b'hello world\n\r'
|
txData = b'hello world\n\r'
|
||||||
uart1.write(txData)
|
uart1.write(txData)
|
||||||
time.sleep(1)
|
time.sleep(0.1)
|
||||||
rxData = bytes()
|
rxData = bytes()
|
||||||
while uart0.any() > 0:
|
while uart0.any() > 0:
|
||||||
rxData += uart0.read()
|
rxData += uart0.read(1)
|
||||||
|
|
||||||
print(rxData.decode('utf-8'))
|
print(rxData.decode('utf-8'))
|
Ładowanie…
Reference in New Issue