Generation 3 of the Harp project

Dependencies:   Servo TMP36 GZ buffered-serial1 chan_fatfs_sd nmea_parser watchdog mbed-rtos mbed

Fork of HARP2 by Tyler Weaver

Committer:
tylerjw
Date:
Thu Feb 23 05:40:54 2012 +0000
Revision:
5:8444ec4245e7
Parent:
3:9cba44dd2f2b
Child:
6:204487243310
0.3 - openLog working and nmea files convert to earth files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tylerjw 0:ce5f06c3895f 1 #include "mbed.h"
tylerjw 5:8444ec4245e7 2 #include "openLog.h"
tylerjw 0:ce5f06c3895f 3 #include "GPS.h"
tylerjw 0:ce5f06c3895f 4
tylerjw 0:ce5f06c3895f 5 Serial pc(USBTX, USBRX);
tylerjw 0:ce5f06c3895f 6 GPS gps(p9, p10);
tylerjw 0:ce5f06c3895f 7
tylerjw 0:ce5f06c3895f 8 int main() {
tylerjw 1:2ace7946a246 9 int gps_message;
tylerjw 5:8444ec4245e7 10 gps.start_log();
tylerjw 1:2ace7946a246 11 while (1) {
tylerjw 1:2ace7946a246 12 gps_message = gps.sample();
tylerjw 3:9cba44dd2f2b 13 if (gps_message == GGA) {
tylerjw 3:9cba44dd2f2b 14 pc.printf("Responding to GGA message.\n");
tylerjw 3:9cba44dd2f2b 15 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 2:0c9ade531a5b 16 pc.printf("%d satelites used\n", gps.get_satelites());
tylerjw 2:0c9ade531a5b 17 pc.printf("altitude = %f M\n\n", gps.get_msl_altitude());
tylerjw 3:9cba44dd2f2b 18 } else if (gps_message == VTG) {
tylerjw 3:9cba44dd2f2b 19 pc.printf("Responding to VTG message.\n");
tylerjw 3:9cba44dd2f2b 20 pc.printf("True heading = %f deg\n", gps.get_course_t());
tylerjw 3:9cba44dd2f2b 21 pc.printf("Magnetic heading = %f deg\n", gps.get_course_m());
tylerjw 3:9cba44dd2f2b 22 pc.printf("Speed = %f knots\n", gps.get_speed_k());
tylerjw 3:9cba44dd2f2b 23 pc.printf("Speed = %f Km/hr\n\n", gps.get_speed_km());
tylerjw 3:9cba44dd2f2b 24 } else if (gps_message == GLL) {
tylerjw 3:9cba44dd2f2b 25 pc.printf("Responding to GLL message.\n");
tylerjw 3:9cba44dd2f2b 26 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 3:9cba44dd2f2b 27 } else if (gps_message == RMC) {
tylerjw 3:9cba44dd2f2b 28 pc.printf("Responding to RMC message.\n");
tylerjw 3:9cba44dd2f2b 29 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 3:9cba44dd2f2b 30 pc.printf("True heading = %f deg\n", gps.get_course_t());
tylerjw 3:9cba44dd2f2b 31 pc.printf("Speed = %f knots\n\n", gps.get_speed_k());
tylerjw 2:0c9ade531a5b 32 } else if (gps_message == NO_LOCK) {
tylerjw 2:0c9ade531a5b 33 pc.printf("Oh Dear! No lock :(\n");
tylerjw 0:ce5f06c3895f 34 }
tylerjw 0:ce5f06c3895f 35 }
tylerjw 0:ce5f06c3895f 36 }