Go Down

Topic: help in GPS code (Read 826 times) previous topic - next topic

mohd9011

hi
iam trying my GPS code but i keep getting this errors i downloaded tinygps library but i couldn't find wprogram.h

the errors:
gps.ino:1:10: error: #include expects "FILENAME" or <FILENAME>
In file included from gps.ino:2:
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:25:22: error: WProgram.h: No such file or directory
In file included from gps.ino:2:
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:81: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:81: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:130: error: 'byte' does not name a type
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:133: error: 'byte' does not name a type
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:134: error: 'byte' does not name a type
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:135: error: 'byte' does not name a type
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h: In member function 'void TinyGPS::get_position(long int*, long int*, long unsigned int*)':
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:48: error: 'millis' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h: In member function 'void TinyGPS::get_datetime(long unsigned int*, long unsigned int*, long unsigned int*)':
C:\Program Files (x86)\Arduino\libraries\TinyGPS10/TinyGPS.h:57: error: 'millis' was not declared in this scope

the code:
Code: [Select]
#include arduino.h
#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(4,5,6,7,8,9);

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);
 lcd.begin(16, 2);
}

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);

 getGPS();
 lcd.setCursor(0,0);
 lcd.print("Lt: ");
 lcd.print(LAT/100000,7);
 lcd.setCursor(0,1);
 lcd.print("Ln: ");
 lcd.print(LON/100000,7);
 
 //Serial.print("Latitude : ");
 //Serial.print(LAT/100000,7);
 //Serial.print(" :: Longitude : ");
 //Serial.println(LON/100000,7);
 
 delay(1000);
 
}

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
 }
}

PaulS

Code: [Select]
#include arduino.h
#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>

There is a pattern here that your added include statement (not needed) failed to follow.

The latest version of TinyGPS has been updated to work with post-1.0 versions of the IDE. Download a newer version.

mohd9011

ok i downloaded ardunio 0022 and compiled the code but still this errors came up

gps_ino.cpp:13:10: error: #include expects "FILENAME" or <FILENAME>
gps_ino.cpp: In function 'bool feedgps()':
gps_ino:78: error: 'class SoftwareSerial' has no member named 'available'

PaulS

Quote
ok i downloaded ardunio 0022

Why?

Quote
gps_ino.cpp:13:10: error: #include expects "FILENAME" or <FILENAME>

Code: [Select]
#include arduino.h
So, where ARE the "" or <>?

Quote
gps_ino:78: error: 'class SoftwareSerial' has no member named 'available'

That's true. It doesn't.

mohd9011


Quote
ok i downloaded ardunio 0022

Why?

isn't it a newer version than the 1.0 version


Quote
gps_ino.cpp:13:10: error: #include expects "FILENAME" or <FILENAME>

Code: [Select]
#include arduino.h
So, where ARE the "" or <>?

i put it


Quote
gps_ino:78: error: 'class SoftwareSerial' has no member named 'available'

That's true. It doesn't.

so how can i solve this?

PaulS

Quote
isn't it a newer version than the 1.0 version

Not by a couple of years. 1.0.5 is the latest non-beta version.

mohd9011

I redownloaded the 1.5 version and i got these errors again

Arduino: 1.5.4 (Windows 7), Board: "Arduino Uno"

gps.ino:1:10: error: #include expects "FILENAME" or <FILENAME>
In file included from gps.ino:2:
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:25:22: error: WProgram.h: No such file or directory
In file included from gps.ino:2:
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:81: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:81: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:82: error: 'byte' has not been declared
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:130: error: 'byte' does not name a type
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:133: error: 'byte' does not name a type
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:134: error: 'byte' does not name a type
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:135: error: 'byte' does not name a type
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h: In member function 'void TinyGPS::get_position(long int*, long int*, long unsigned int*)':
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:48: error: 'millis' was not declared in this scope
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h: In member function 'void TinyGPS::get_datetime(long unsigned int*, long unsigned int*, long unsigned int*)':
C:\Users\mohd\Desktop\arduino-1.5.4\libraries\TinyGPS10/TinyGPS.h:57: error: 'millis' was not declared in this scope


lar3ry

You wouldn't get this:

Quote
gps.ino:1:10: error: #include expects "FILENAME" or <FILENAME>


if you had " or <> arrounfd an include filename..
There are 10 kinds of people in the world,
those who understand binary, and those who don't.

PaulS

Quote
I redownloaded the 1.5 version

Try again. Download the 1.0.5 version. NOT SOME OTHER STINKING VERSION!

Then, download the latest copy of TinyGPS. NOT SOME OLD VERSION!

Go Up