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:
Wed Feb 22 04:15:52 2012 +0000
Revision:
1:2ace7946a246
Parent:
0:ce5f06c3895f
Child:
2:0c9ade531a5b
RMC messages and non-waiting sample function

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 1:2ace7946a246 11 if (gps_message != NO_MSG) { // 0 is no message
tylerjw 1:2ace7946a246 12 if (gps_message == PARSED) {
tylerjw 1:2ace7946a246 13 pc.printf("I'm at %f, %f\n", gps.get_dec_longitude(), gps.get_dec_latitude());
tylerjw 1:2ace7946a246 14 pc.printf("%d satelites used\n", gps.get_satelites());
tylerjw 1:2ace7946a246 15 pc.printf("altitude = %f M\n\n", gps.get_msl_altitude());
tylerjw 1:2ace7946a246 16 } else if (gps_message == NO_LOCK) {
tylerjw 1:2ace7946a246 17 pc.printf("Oh Dear! No lock :(\n");
tylerjw 1:2ace7946a246 18 } else if (gps_message == NOT_PARSED) {
tylerjw 1:2ace7946a246 19 pc.printf("\n\n -- Message not Parsed --\n\n");
tylerjw 1:2ace7946a246 20 }
tylerjw 0:ce5f06c3895f 21 }
tylerjw 0:ce5f06c3895f 22 }
tylerjw 0:ce5f06c3895f 23 }