Go Down

Topic: No NMEA from GPS  (Read 109 times) previous topic - next topic

matop

Hello,

I have a problem with my project :

I write this code to test my new Neo6M GPS. Firstly, it works : the serial monitor wrote all NMEA sentences. So it indicates me that wiring was OK.
Then i try to test some code from TinyGPS librairy. After some inconclusives tests, i decide to come back to first code (below). And now i can't get the NMEA sentences, instead i get numbers series like

Quote
44
65
44
49
44
44
44
44
44
I think I changed settings, but i don't know how to come back to initials settings.
Have you an idea to fix this ?


Code: [Select]
#include "SoftwareSerial.h"
SoftwareSerial ss(2, 3); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println("Connected to Neo 6M");
  ss.begin(9600);
}

void loop() {
  if (ss.available()){
    Serial.print(ss.read());
  }
}



Thanks you

Matthieu

matop

Oups, i found my mistake.
I write
Code: [Select]
Serial.print(ss.read())
instead of
Code: [Select]
Serial.write(ss.read())

Sorry

PaulS

Quote
Oups, i found my mistake.
I write ... instead of
Even better would be to handle the data properly.

Code: [Select]
void loop()
{
   if(ss.available())
   {
      char c = ss.read();
      Serial.print(c);
   }
}

matop

Thank you for this anwser, but there is something I don't understand :
Why if put a delay, my answer in Serial Monitor doesn't print the whole string only one character by one character every second ?

void loop()
{
  if(ss.available())
  {
     char c = ss.read();
     Serial.print(c);
     delay(1000);
  }
}

PaulS

Quote
Why if put a delay, my answer in Serial Monitor doesn't print the whole string only one character by one character every second ?
Because that is what you are telling it to do.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy