begin() – initialises the GPS library. It detects if an embedded receiver is available and shares (or consumes) the GPS information on the CAN bus via the Datapool with nodes in the default CAN-ID range (0x765 .. 0x76F).

begin( u16_peer_range_low_CANID, u16_peer_range_high_CANID ) – see above but explicitly defines the range of CAN-IDs of the other nodes participating in the GPS datapool.

begin( ExtSerial, baudrate ) – see above but makes use of an external GNSS receiver that is connected to ‘ExtSerial’ interface (e.g. RS232_1 on a dice-RS232).


GPS.begin( u16_peer_range_low_CANID, u16_peer_range_high_CANID);
GPS.begin( ExtSerial, baudrate );


uint16_t u16_peer_range_low_CANID – lowest CAN-ID of the range of dice-nodes that would possibly join the GPS datapool.
uint16_t u16_peer_range_high_CANID– highest CAN-ID of the range of dice-nodes that would possibly join the GPS datapool.
HardwareSerial* ExtSerial – pointer to the instance representing the serial interface used to connect an external receiver (e.g RS232_1)
unsigned long baudrate – baudrate of the serial interface to the ext. receiver (typ. 9600).

Note: by default dice devices operate in the range of 0x766 .. 0x76F which is also the default range used for the gps-datapool used when calling the begin() function without parameters.


int – 0: OK

Example Code

The following example runs on any dice device. It either receives the GPSdata itself or gets it from a capable node on the CAN bus (via data pool)

#include "DICE_GPS.h"
void setup()
void loop()
  Serial.println("GPS data:");
  Serial.println("- latitude: "+String(GPS.latitude()));
  Serial.println("- longitude:"+String(GPS.longitude()));

Notes and Warnings

This library auto includes the libraries ‘Datapool.h’ and ‘RTCSAMC.h’ making the global object ‘rtc’ available, too.

Examples can be found in the Arduino IDE menu:
File -> Examples -> DICE_GPS ->

See also

Find more details here: