Datasheet

4
3. Usage
3.1 With Arduino
This sample simply reads from the GPS using software serial and sends it back out on the serial
port.
Connect the Grove-GPS to Digital I/O 2 on the Grove - Base Shield using a Grove Universal 4 pin
cable.
Upload the code below. Please click here if you do not know how to upload.
// link between the computer and the SoftSerial Shield
//at 9600 bps 8-N-1
//Computer is connected to Hardware UART
//SoftSerial Shield is connected to the Software UART:D2&D3
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(2, 3);
unsigned char buffer[64]; // buffer array for data receive
over serial port
int count=0; // counter for buffer array
void setup()
{
SoftSerial.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino
baud rate.
}
void loop()
{
if (SoftSerial.available()) // if date is coming from
software serial port ==> data is coming from SoftSerial shield
{
while(SoftSerial.available()) // reading data into char
array
{
buffer[count++]=SoftSerial.read(); // writing data into
array
if(count == 64)break;
}