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

    Which Serial is Port.C on the M5Paper?

    Scheduled Pinned Locked Moved Arduino
    2 Posts 1 Posters 1.4k Views 1 Watching
    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.
    • F Offline
      frank_b
      last edited by

      hello,

      like to use the m5paper port.c to serial read a gps. cannot seem to find which serial port is port.c. Serial is USB-C port, so is it Serial1? documentation only mentions g18/g19...

      thanks
      frank

      F 1 Reply Last reply Reply Quote 0
      • F Offline
        frank_b @frank_b
        last edited by

        answering my own question:

        #include <M5EPD.h>
        #include <TinyGPS++.h>
        
          static const uint32_t GPSBaud = 9600;
        
        TinyGPSPlus gps;
        HardwareSerial ss(2);
        
        M5EPD_Canvas canvas(&M5.EPD);
        
        char latStr[10];
        char lonStr[10];
        char speedStr[10];
        
        void setup() {
        
          M5.begin();
          M5.EPD.SetRotation(0);
          M5.EPD.Clear(true);
        
          ss.begin(GPSBaud, SERIAL_8N1, 19, 18);
        
          canvas.createCanvas(960, 540);
          canvas.setTextSize(3);
          canvas.clear();
        }
        
        void loop() {
        
          int b = ss.available();
        
          while (b > 0) {
        
            gps.encode(ss.read());
        
            double lat = gps.location.lat();
            double lon = gps.location.lng();
            double speed = gps.speed.kmph();
        
            dtostrf(lat, 2, 2, latStr);
            dtostrf(lon, 2, 2, lonStr);
            dtostrf(speed, 2, 2, speedStr);
        
            canvas.clear();
            canvas.drawString("Lat:   " + String(latStr), 50, 100);
            canvas.drawString("Lon:   " + String(lonStr), 50, 150);
            canvas.drawString("Speed: " + String(speedStr), 50, 200);
            canvas.pushCanvas(0, 0, UPDATE_MODE_DU4);
          }
        }
        
        1 Reply Last reply Reply Quote 0

        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