We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Im not sure how to get the GGA message from msg variable, the message var seems to contain all or the parsed messages
msg
import pynmea2 import serial ser = serial.Serial('/dev/ttyS1', 9600, timeout=5.0) sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser)) while 1: try: line = sio.readline() msg = pynmea2.parse(line) print(repr(msg)) except serial.SerialException as e: print('Device error: {}'.format(e)) break except pynmea2.ParseError as e: print('Parse error: {}'.format(e)) continue
This is my current code
_ser = serial.Serial(GPS_PORT, 19200, timeout=1.0) _gps = io.TextIOWrapper(io.BufferedRWPair(_ser, _ser)) def get_gps_data_v2 (): while 1: try: data = _gps.readline() prefix = data[0:6] if prefix == "$GPGGA": msg = pynmea2.parse(data) location = {} location["latitude"] = msg.latitude location["longitude"] = msg.longitude location["altitude"] = msg.altitude return json.dumps(location) except serial.SerialException as e: print('Device error: {}'.format(e)) break except pynmea2.ParseError as e: print('Parse error: {}'.format(e)) continue
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Im not sure how to get the GGA message from
msg
variable, the message var seems to contain all or the parsed messagesThis is my current code
The text was updated successfully, but these errors were encountered: