Using Software Serial on MKR1000

I have a sketch I made for Uno R3 and I want to try it on the MKR1000. Compiling it gives software serial error, and I've looked around for that error, seems that MKR can't use the SoftwareSerial.h

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 8, TXPin = 3;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

This is the opening of my sketch, and in the void setup and loop I have entries such as "ss.begin(GPSBaud);" and "ss.read()" and so on.

I've found a post on github about solving this on the MKR - Arduino-Test/sercom.ino at master · guywithaview/Arduino-Test · GitHub

But I'm not that well versed in tweaking this - can someone show me how can I make this sercom.ino "hack" work on the MKR1000 in my case scenario where "ss" calls for TX and RX?

Serial is the native USB interface and you have Serial1 by default on D13, D14 (Sercom 5)

#include <TinyGPS++.h>
TinyGPSPlus gps;

void setup()
{
  Serial.begin(115200);
  Serial1.begin(9600);
}

void loop()
{
  while (Serial1.available() > 0) {
    if (gps.encode(Serial1.read())) {
      // got a new sentence
    }
  }
  // other stuff    
}

(assuming you have the right voltage adaptor between your GPS and the MKR as the Serial line will accept only 3.3V as input)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.