rodzic
335ef9381e
commit
8b1bf5f30c
|
@ -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 <<uart-wiring-diagram>> 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.
|
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'
|
||||
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'))
|
Ładowanie…
Reference in New Issue