Created
February 23, 2021 07:23
-
-
Save romilly/f216d9bc1ef9bed635b49ad37382031b to your computer and use it in GitHub Desktop.
Drive UART1 on a Raspberry Pi Pico
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
MicroPython code to read and write from UART1 on the Pico | |
UART0 is not available as it is used for the REPL. | |
To test, you can use a 3V3 FTDI cable or similar device that connects a host computer with the Pico. | |
NB: Make sure it's a 3V3 cable, not a 5V cable, or you could kill your PIco!! | |
Connect FTDI black to Pico GND. | |
Connect FTDI yellow to Pico GP4. | |
Connect FTDI orange to Pico GP5. | |
""" | |
from machine import UART | |
ser = UART(1, 115200) | |
ser.write('Hello UART!\r\n') | |
while True: | |
ch = ser.read(1) | |
reply = 'I saw %s \r\n' % ch | |
ser.write(reply) | |
print(reply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment