Which Serial is Port.C on the M5Paper?
-
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 -
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); } }
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