In this video lesson we will show you how to connect and begin to get data from your Raspberry Pi Pico W connected to an Adafruit Ultimate GPS. The circuit schematic presented below. Notice Tx on the Pi Pico goes to Rx on the GPS, and Rx on the Pi Pico goes to Tx on the GPS.

Then this is our initial code which reads the data from the GPS one byte at a time and prints it. In future lessons we will explain how to get useful information from this data, but for now, this code will allow you to read the data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from machine import Pin,I2C,UART import time GPS = UART(1, baudrate = 9600, tx=machine.Pin(8), rx=machine.Pin(9)) try: while True: if GPS.any(): myChar=GPS.read(1).decode('utf-8') print(myChar, end="") except KeyboardInterrupt: print("\n . . . Cleaning Up UART") GPS.deinit() time.sleep(1) print("Cleanly Exited UART") |