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

    Help with the GPS module and M5Stack for AWS

    Modules
    2
    3
    1.6k
    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
      skhaz
      last edited by

      I have an M5Stack for AWS, and I have a GPS module connected to its port C. What is the index of the HardwareSerial I should use?

      I tried from 0 to 6, but I had no luck reading the data.

      HardwareSerial GPSRaw(2);
      
      void loop() {
        if (GPSRaw.available())
        {
          int ch = GPSRaw.read();
          Serial.write(ch);
        }
      }
      

      Connection

      0_1689279562359_cca83b01-1be3-489c-90d9-b56ed0be219a-telegram-cloud-photo-size-1-5008453422650862428-y.jpg

      What I am doing wrong?

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @skhaz

        have a look at the M5Core2 GPS example. M5Core2 UART uses GPIO 13/14 whereas M5Stack uses GPIO 16/17. If GPSRaw.begin() is called w/o parameters then GPIO 16/17 are used by default. Try something like below to change the GPIOs:

        GPSRaw.begin(9600, SERIAL_8N1, 13, 14);
        

        BTW: Index 2 is fine.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • S
          skhaz
          last edited by

          @felmue it worked flawless, thank you so much!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post