🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    GPS (AT6558) at Thonny editor

    Scheduled Pinned Locked Moved Micropython
    2 Posts 2 Posters 4.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      schotek
      last edited by

      I have code in Micropython to communicate with the GPS unit connected to port A (because I use plain Gray M5Stack unit) and using Thonny editor.

      If I upload code directly to the device a run it from the menu, it works well. But if I try to run it directly from Thonny editor (it uses REPL mode I guess), I got this error:

      Unit: Please change unit gps to other grove
      

      It is very simple code and it looks like this:

      import os
      from m5stack import *
      from m5ui import *
      from uiflow import *
      import unit
      
      setScreenColor(0x222222)
      gps0 = unit.get(unit.GPS, unit.PORTA)
      
      label0 = M5TextBox(92, 85, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
      label1 = M5TextBox(92, 70, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
      
      while True:
        label0.setText(str(gps0.pos_quality))
        label1.setText(str(gps0.satellite_num))
        wait_ms(2)
      

      Do you have any tips?

      1 Reply Last reply Reply Quote 0
      • S Offline
        SP3SWJ
        last edited by

        Hi, In GRAY M5STACK unfortunatelly PortA is used for I2C to some internal chip. Sometime GPS not work on Grove Cable.

        Just connect GPS to
        16RX <<< TX White
        17TX >>> Rx Yellow
        And all start working with no problem.

        Example code from Arduino works if You add

        #define RX1 16
        #define TX1 17
        ...
        void setup()
        {
        M5.begin();
        M5.Power.begin();
        GPSRaw.begin(9600, SERIAL_8N1,RX1,TX1);

        0_1620524777250_30c66d7b-be90-4ac1-80ac-0815ae8019a6-image.png

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post