0

I'm stuck with my waveshare hat and it would be cool if you could help me. I would like to obtain the gps location.

I'm a python beginner and tried to use some already written code from this websites:

https://www.waveshare.com/w/upload/4/4a/GSM_GPRS_GNSS_HAT_User_Manual_EN.pdf Throws an error for the sleep function and when I outcommand it, it gives an error

https://www.rhydolabz.com/wiki/?p=18639 Throws an error for the if loop.

https://www.youtube.com/watch?v=A1zmhxcUOxw Works maybe but doesn't receive any signal from gps hat.

Unfortunately, I assume that this code is written in Python2 and it will throw an error while executing it. All my attempts to change that code in a python3 code failed.

Do you have any recommendations for me?

Thank you very much.

10
  • Ah, let me see. So you have two problems: (1) How to get GPS data using Python 3, (2) How to convert python 2 code to python 3. For the first problem, you can read my anser to the following question: "Rpi UART to GPS Module Connection Problem": raspberrypi.stackexchange.com/questions/98840/…. But if your WaveShare GPS module is different from mine, you need a lot to time to learn how to do GPSD. (2) If the WaveShare code is in python 2, It is not that difficult to do the conversion. You can find semiautomatic tools to help you. / 歉欲阱划岐, ...
    – tlfong01
    Commented Dec 10, 2019 at 9:09
  • Obvious and simple conversions include [print "abc"] becomes [print("abc")]. In case the translation is not python generic, but Rpi and GPS specific, such as cannot find modules to import, then you can show us that particular code snippet and see if anybody can help you.
    – tlfong01
    Commented Dec 10, 2019 at 9:12
  • 1
    Thanks so far, first I'll try to convert my code to python3, if I still have problems afterwards, I'll come back to you
    – Philipp
    Commented Dec 10, 2019 at 9:15
  • I skimmed through the WaveShare GPS module user manual and find a section for Rpi (Page 29). For newbies, you need to use Rpi MiniCom (I prefer Rpi CuteCom) to give AT commands by hand. If you find manual mode OK. Then you can write a simple pyhon program to do the AT instruction/status communication (let me know if you cannot find examples). You can find SIM800 modules in this forum, which is similar to this part of manual.
    – tlfong01
    Commented Dec 10, 2019 at 9:19
  • Just now I skimmed the tutorial which you mention "Throws an error for the if loop ..." is indeed the python program doing serial communication with AT commands. This is the most basic program ALL newbies need to learn. Search for "Rpi python serial "loop back" test programs" in this forum to learn more." Let me know if you get stuck in loopback testing. Good luck and cheers.
    – tlfong01
    Commented Dec 10, 2019 at 9:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.