Hi
I want to read the data from this gps-sensor https://www.sparkfun.com/products/11058
and want to print this on my serial monitor. The sensor is connected via the serial1 ports (pin18-tx1 pin19-rx1).
Now I have problems with the communication between the RX1 port and the RX port connected to my PC and the serial monitor.
int rx1pin = 19; // gps-rx
char gpsoutput;
const int sentenceSize = 80;
char sentence[sentenceSize];
void setup() {
Serial.begin(9600); //serial PC
Serial1.begin(9600); //serial gps
pinMode(rx1pin, INPUT); // Initialize LED pin
}
void loop() {
static int i = 0;
// send data only when you receive data:
if (Serial.available()>0)
{
gpsoutput=Serial1.read(); //read gps-signal
if (gpsoutput != '\n' && i < sentenceSize)
{
sentence[i] = gpsoutput;
i++;
}
else
{
sentence[i] = '\0';
i = 0;
}
Serial.write(sentence); //write on serial monitor
}
}
The output is pure nonsens, or better, I don't understand the output =).
First of all the output starts with ????. And nothing follows. If I enter any char via the serial monitor, output starts to send endless questionmarks like this ?. So while I only send one char, I assume this is some data from the sensor.
I did some research and checked already the BAUD rate. Serial monitor is also 9600 and the datasheet says:
Baud Rate 4800 / 9600 / 38400 / 115200
I hope you have any ideas
Ali