Generation 2 of the Harp project

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

Committer:
tylerjw
Date:
Wed Feb 22 05:24:47 2012 +0000
Revision:
3:9cba44dd2f2b
Parent:
2:0c9ade531a5b
Child:
5:8444ec4245e7
0.2 fixed bugs

Who changed what in which revision?

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