Skip to content
New issue

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

TypeError: ord() expected a character, but string of length 64 found #49

Open
killsecurly opened this issue Dec 12, 2024 · 1 comment
Open

Comments

@killsecurly
Copy link

killsecurly commented Dec 12, 2024

Using CircuitPython / board.UART / Pi Pico 2 for:

import micropyGPS, board, busio, adafruit_gps

uart = busio.UART(board.GP16, board.GP17, baudrate=9600, timeout=100)
adagps = adafruit_gps.GPS(uart, debug=False)

adagps.send_command(b'PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0')
adagps.send_command(b"PMTK220,1000")

gps = micropyGPS.MicropyGPS()

while True:
    data = uart.read(64)  # read up to 64 bytes
    # print(data)  # this is a bytearray type

    if data is not None:
        data_string = ''.join([chr(b) for b in data])
        gps.update(data_string)

Once ran, it provides:

Traceback (most recent call last):
  File "code.py", line 14, in <module>
  File "micropyGPS.py", line 563, in update
TypeError: ord() expected a character, but string of length 75 found
@killsecurly killsecurly changed the title TypeError: ord() expected a character, but string of length 75 found TypeError: ord() expected a character, but string of length 64 found Dec 12, 2024
@dobodu
Copy link

dobodu commented Dec 23, 2024

I'm not a pro with circuitpython but I did the same mistake at the first use.

MicroGPS parse only Char by Char and you are submitting "data_string",

You should write :

for x in data_string() :
my_gps.update(x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants