error in programming for GPS skm53

#include <TinyGPS.h>
#include <NewSoftSerial.h>
unsigned long fix_age;
NewSoftSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
void setup(){
GPS.begin(9600);
Serial.begin(115200);
}
void loop(){
long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);
// time in hh:mm:ss, date in dd/mm/yy
/*gps.get_datetime(&date, &time, &fix_age);
year = date % 100;
month = (date / 100) % 100;
day = date / 10000;
hour = time / 1000000;
minute = (time / 10000) % 100;
second = (time / 100) % 100;
Serial.print("Date: ");
Serial.print(year); Serial.print("/");
Serial.print(month); Serial.print("/");
Serial.print(day);
Serial.print(" :: Time: ");
Serial.print(hour); Serial.print(":");
Serial.print(minute); Serial.print(":");
Serial.println(second);
*/
getGPS();
Serial.print("Latitude : ");
Serial.print(LAT/100000,7);
Serial.print(" :: Longitude : ");
Serial.println(LON/100000,7);
}
void getGPS(){
bool newdata = false;
unsigned long start = millis();
// Every 1 seconds we print an update
while (millis() - start < 1000)
{
if (feedgps ()){
newdata = true;
}
}
if (newdata)
{
gpsdump(gps);
}
}
bool feedgps(){
while (GPS.available())
{
if (gps.encode(GPS.read()))
return true;
}
return 0;
}
void gpsdump(TinyGPS &gps)
{
//byte month, day, hour, minute, second, hundredths;
gps.get_position(&lat, &lon);
LAT = lat;
LON = lon;
{
feedgps(); // If we don't feed the gps during this long
//routine, we may drop characters and get checksum errors
}

error:expected'}' at the end of input.

In file included from sketch_mar10a.cpp:2:
C:\Intel\Downloads\arduino-1.0\libraries\NewSoftSerial/NewSoftSerial.h:33:2: error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
In file included from sketch_mar10a.cpp:2:
C:\Intel\Downloads\arduino-1.0\libraries\NewSoftSerial/NewSoftSerial.h:99: error: conflicting return type specified for 'virtual void NewSoftSerial::write(uint8_t)'
C:\Intel\Downloads\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'

So, what is the problem? The messages are telling you EXACTLY what you need to fix.

sketch_mar09a.ino: In function 'void gpsdump(TinyGPS&)':
sketch_mar09a:77: error: expected `}' at end of input

{ and } must be matched pairs. You have 2 { and 1 }. Fix that.

Use SoftwareSerial instead of NewSoftSerial in ino files.

now it is error compiling

In file included from sketch_mar09a.ino:2:
C:\Intel\Downloads\arduino-1.0.3\libraries\NewSoftSerial/NewSoftSerial.h:33:2: error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
In file included from sketch_mar09a.ino:2:
C:\Intel\Downloads\arduino-1.0.3\libraries\NewSoftSerial/NewSoftSerial.h:99: error: conflicting return type specified for 'virtual void NewSoftSerial::write(uint8_t)'
C:\Intel\Downloads\arduino-1.0.3\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'

this is the change program

#include <TinyGPS.h>
#include <NewSoftSerial.h>

unsigned long fix_age;
NewSoftSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
    GPS.begin(9600);
    //Serial.begin(115200);
}

void loop(){
    long lat, lon;
    unsigned long fix_age, time, date, speed, course;
    unsigned long chars;
    unsigned short sentences, failed_checksum;

    // Retrieves +/- latitude/longitude in 100000ths of a degree.
    gps.get_position(&lat, &lon, &fix_age);

    getGPS();
    Serial.print("Latitude : ");
    Serial.print(LAT/100000,7);
    Serial.print(" :: Longitude : ");
    Serial.println(LON/100000,7);
}

void getGPS(){
    bool newdata = false;
    unsigned long start = millis();
    // Every 1 seconds we print an update.
    while (millis() - start < 1000)
    {
        if (feedgps ()){
            newdata = true;
        }
    }
    if (newdata)
    {
        gpsdump(gps);
    }
}

bool feedgps(){
    while (GPS.available())
    {
        if (gps.encode(GPS.read()))
            return true;
    }
    return 0;
}

void gpsdump(TinyGPS &gps)
{
    //byte month, day, hour, minute, second, hundredths;
    gps.get_position(&lat, &lon);
    LAT = lat;
    LON = lon;
    
        {feedgps(); // If we don't feed the GPS during this long
                   //routine, we may drop characters and get 
                   //checksum errors.
        }    }

You apparently aren't listening, so it will do no good to tell you not to use NewSoftSerial with 1.0+.

i have used it with newsoftserial.that worked well but gps was not giving me any value.why is that?

remove bugs and send me plz

gps not giving values


sajid-wahid00:

    GPS.begin(9600);

//Serial.begin(115200);

How would you know if the GPS was working if you aren't enabling Serial?

progrm compiled correctly.no log and lat value coming

i write this program that comliled well for gps skm53

#include <TinyGPS.h>
#include <SoftwareSerial.h>
unsigned long fix_age;
SoftwareSerial GPS(2,3);

TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
void setup(){
  GPS.begin(9600);
  Serial.begin(115200);
}
void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;
  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);
  // time in hh:mm:ss, date in dd/mm/yy
  /*gps.get_datetime(&date, &time, &fix_age);
   year = date % 100;
   month = (date / 100) % 100;
   day = date / 10000;
   hour = time / 1000000;
   minute = (time / 10000) % 100;
   second = (time / 100) % 100;
   Serial.print("Date: ");
   Serial.print(year); Serial.print("/");
   Serial.print(month); Serial.print("/");
   Serial.print(day);
   Serial.print(" :: Time: ");
   Serial.print(hour); Serial.print(":");
   Serial.print(minute); Serial.print(":");
   Serial.println(second);
   */
  getGPS();
  Serial.print("Latitude : ");
  Serial.print(LAT/100000,7);
  Serial.print(" :: Longitude : ");
  Serial.println(LON/100000,7);
}
void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}
bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}
void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long  routine, we may drop characters and get checksum errors
  }
}

Do the text labels print ?

i have used it with newsoftserial.that worked

Really? That's why the compiler was telling you not too?

Oh, well. You're the expert. I'm sure you'll figure it out. Eventually.

A man goes to the doctor and says "I have a headache" Doctor says take 2 of these you'll be fine
Man says "Doctor I don't want no pills... Just Fix My Headache. NOW

  Serial.print(LAT/100000,7);

Dream on.

Just Fix My Headache.

A quick trip to the guillotine will take care of the headache. Permanently.

Yeah just think of the Karma you could get for that!... Already got the dogma..., Maybe We'll All get lucky...

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

  • Moderator

My suggestion would be to just copy the serial data, which the gps device is sending to the arduino, to the serial monitor, without trying to parse it using the tinygps or anything else.

Then you will know, if your device and your serial communication is working. Then you can start worrying about processing the data.

The GPS will only work outside or if you have a really big window.

It's a good thing that the Iranian rocket program is run by smart people like you.

what to do with it?

  Serial.print(LAT/100000,7);