Skip to content

Instantly share code, notes, and snippets.

@matteobertozzi
Created June 9, 2023 15:00
Show Gist options
  • Save matteobertozzi/c22de3c792af3a046bb86c161c041c82 to your computer and use it in GitHub Desktop.
Save matteobertozzi/c22de3c792af3a046bb86c161c041c82 to your computer and use it in GitHub Desktop.
Read U-blox M9N GNSS from /dev/ttyS3
import serial # (ubuntu python3-serial package) - https://pyserial.readthedocs.io/en/latest/
def gps_read():
# nROK 1031 Built-in U-blox M9N GNSS is on /dev/ttyS3 (Ubuntu 22.04 LTS)
with serial.Serial('/dev/ttyS3', baudrate=38400) as sd:
sd.flushInput()
sd.flushOutput()
while True:
yield sd.readline()
for nmea_sentence in gps_read():
print(nmea_sentence) # b'$GNRMC,....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment