this code is not working with 1.7.6 SAMD libraries
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define ss Serial
// The TinyGPS++ object
TinyGPSPlus gps;
char c;
//static const int RXPin = 0, TXPin = 1;
// The serial connection to the GPS device
//SoftwareSerial ss(RXPin, TXPin);
void setup()
{
// put your setup code here, to run once:
SerialUSB.begin(115200);
while (!SerialUSB)
;
ss.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
smartDelay(1000);
}
// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (ss.available())
gps.encode(c = ss.read());
if (c != '\n')
SerialUSB.print(c);
} while (millis() - start < ms);
}
But this was working in 1.3.0 version
as i intepreted Serial.print is also considered as SerialUSB.print
i found a change done is samd variant.h… here it is…
in 1.3.0/variant/variant.h
#define SERIAL_PORT_USBVIRTUAL SerialUSB #define SERIAL_PORT_MONITOR Serial // Serial has no physical pins broken out, so it’s not listed as HARDWARE port #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 #endif /VARIANT_ARDUINO_ZERO/
in 1.6.0/variant/variant.h #define SERIAL_PORT_USBVIRTUAL Serial #define SERIAL_PORT_MONITOR Serial // Serial has no physical pins broken out, so it’s not listed as HARDWARE port #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 // Alias Serial to SerialUSB #define SerialUSB Serial #endif /VARIANT_ARDUINO_ZERO/
Great, Is it solved? If not you can downgrade the libraries or board definitions using the Arduino IDE it self, Just need to select the suitable version.