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:
Fri Feb 24 21:28:33 2012 +0000
Revision:
6:204487243310
Parent:
5:8444ec4245e7
Child:
7:d8ecabe16c9e
altitude if ft, updated and fixed bugs

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 6:204487243310 9 pc.baud(9600);
tylerjw 1:2ace7946a246 10 int gps_message;
tylerjw 5:8444ec4245e7 11 gps.start_log();
tylerjw 1:2ace7946a246 12 while (1) {
tylerjw 1:2ace7946a246 13 gps_message = gps.sample();
tylerjw 3:9cba44dd2f2b 14 if (gps_message == GGA) {
tylerjw 3:9cba44dd2f2b 15 pc.printf("Responding to GGA message.\n");
tylerjw 3:9cba44dd2f2b 16 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 2:0c9ade531a5b 17 pc.printf("%d satelites used\n", gps.get_satelites());
tylerjw 6:204487243310 18 pc.printf("altitude = %f ft\n", gps.get_altitude_ft());
tylerjw 2:0c9ade531a5b 19 pc.printf("altitude = %f M\n\n", gps.get_msl_altitude());
tylerjw 3:9cba44dd2f2b 20 } else if (gps_message == VTG) {
tylerjw 3:9cba44dd2f2b 21 pc.printf("Responding to VTG message.\n");
tylerjw 3:9cba44dd2f2b 22 pc.printf("True heading = %f deg\n", gps.get_course_t());
tylerjw 3:9cba44dd2f2b 23 pc.printf("Magnetic heading = %f deg\n", gps.get_course_m());
tylerjw 3:9cba44dd2f2b 24 pc.printf("Speed = %f knots\n", gps.get_speed_k());
tylerjw 3:9cba44dd2f2b 25 pc.printf("Speed = %f Km/hr\n\n", gps.get_speed_km());
tylerjw 3:9cba44dd2f2b 26 } else if (gps_message == GLL) {
tylerjw 3:9cba44dd2f2b 27 pc.printf("Responding to GLL message.\n");
tylerjw 3:9cba44dd2f2b 28 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 3:9cba44dd2f2b 29 } else if (gps_message == RMC) {
tylerjw 3:9cba44dd2f2b 30 pc.printf("Responding to RMC message.\n");
tylerjw 3:9cba44dd2f2b 31 pc.printf("I'm at %f, %f\n", gps.get_dec_latitude(), gps.get_dec_longitude());
tylerjw 3:9cba44dd2f2b 32 pc.printf("True heading = %f deg\n", gps.get_course_t());
tylerjw 3:9cba44dd2f2b 33 pc.printf("Speed = %f knots\n\n", gps.get_speed_k());
tylerjw 6:204487243310 34 } else if (gps_message == NOT_PARSED) {
tylerjw 6:204487243310 35 pc.printf("Message not parsed!\n");
tylerjw 2:0c9ade531a5b 36 } else if (gps_message == NO_LOCK) {
tylerjw 2:0c9ade531a5b 37 pc.printf("Oh Dear! No lock :(\n");
tylerjw 0:ce5f06c3895f 38 }
tylerjw 0:ce5f06c3895f 39 }
tylerjw 0:ce5f06c3895f 40 }