Hi everyone,
I'm struggling to get a reading from my Grove GPS module on an Uno. Nothing else connectioned, not using the 0,1 serial pin.
#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;
}
Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
SoftSerial.write(Serial.read()); // write it to the SoftSerial shield
}
void clearBufferArray() // function to clear buffer array
{
for (int i=0; i<count;i++)
{
buffer[i]=NULL;
} // clear all index of array with command NULL
}
My serial output is;
$GPRMC,162906.218,V,,,,,0.07,131.33,270721,,,N*49
$GPGGA,162908.000,,,,,0,2,,,M,,M,,4E
$GPRMC,162908.000,V,,,,,0.10,131.33,270721,,,N4A
$GPGGA,162909.000,,,,,0,2,,,M,,M,,4F
$GPRMC,162909.000,V,,,,,0.11,131.33,270721,,,N4A
$GPGGA,162910.000,,,,,0,2,,,M,,M,,47
$GPRMC,162910.000,V,,,,,0.12,131.33,270721,,,N41
$GPGGA,162911.000,,,,,0,2,,,M,,M,,46
$GPRMC,162911.000,V,,,,,0.12,131.33,270721,,,N40
$GPGGA,162912.000,,,,,0,2,,,M,,M,,45
$GPRMC,162912.000,V,,,,,0.10,131.33,270721,,,N41
$GPGGA,162912.218,,,,,0,2,,,M,,M,,4E
$GPRMC,162912.218,V,,,,,0.07,131.33,270721,,,N4C
My actual co ordinates currently at 50, -3.
I've tried using the tinyGps library, but the system just freezes.