本文整理汇总了C++中TinyGPS::f_course方法的典型用法代码示例。如果您正苦于以下问题:C++ TinyGPS::f_course方法的具体用法?C++ TinyGPS::f_course怎么用?C++ TinyGPS::f_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TinyGPS
的用法示例。
在下文中一共展示了TinyGPS::f_course方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getgps
void getgps(TinyGPS &gps) {
// To get all of the data into varialbes that you can use in your code,
// all you need to do is define variables and query the object for the
// data. To see the complete list of functions see keywords.txt file in
// the TinyGPS and NewSoftSerial libs.
// Define the variables that will be used
float latitude, longitude;
// Then call this function
gps.f_get_position(&latitude, &longitude);
// You can now print variables latitude and longitude
Serial.print("Lat/Long: ");
Serial.print(latitude, 5);
Serial.print(", ");
Serial.println(longitude, 5);
// Same goes for date and time
int year;
byte month, day, hour, minute, second, hundredths;
gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths);
// Print data and time
Serial.print("Date: ");
Serial.print(month, DEC);
Serial.print("/");
Serial.print(day, DEC);
Serial.print("/");
Serial.print(year);
Serial.print(" Time: ");
Serial.print(hour, DEC);
Serial.print(":");
Serial.print(minute, DEC);
Serial.print(":");
Serial.print(second, DEC);
Serial.print(".");
Serial.println(hundredths, DEC);
//Since month, day, hour, minute, second, and hundr
// Here you can print the altitude and course values directly since
// there is only one value for the function
Serial.print("Altitude (meters): ");
Serial.println(gps.f_altitude());
// Same goes for course
Serial.print("Course (degrees): ");
Serial.println(gps.f_course());
// And same goes for speed
Serial.print("Speed(kmph): ");
Serial.println(gps.f_speed_kmph());
Serial.println();
// Here you can print statistics on the sentences.
unsigned long chars;
unsigned short sentences, failed_checksum;
gps.stats(&chars, &sentences, &failed_checksum);
//Serial.print("Failed Checksums: ");Serial.print(failed_checksum);
//Serial.println(); Serial.println();
}