Testing documentation

Dependencies:   mbed

Committer:
sgrove
Date:
Mon Apr 18 04:16:13 2011 +0000
Revision:
4:3f1a2b5dc176
Parent:
3:987ee333d593
r3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrove 4:3f1a2b5dc176 1 /** @defgroup API The MODGPS API */
sgrove 4:3f1a2b5dc176 2
sgrove 4:3f1a2b5dc176 3 /** GPS module
sgrove 4:3f1a2b5dc176 4 * @author Andy Kirkham
sgrove 4:3f1a2b5dc176 5 * @see http://mbed.org/cookbook/MODGPS
sgrove 4:3f1a2b5dc176 6 * @see example1.cpp
sgrove 4:3f1a2b5dc176 7 * @see example2.cpp
sgrove 4:3f1a2b5dc176 8 * @see API
sgrove 4:3f1a2b5dc176 9 *
sgrove 4:3f1a2b5dc176 10 * @image html /media/uploads/AjK/gps_interfaces.png "Wiring up the GPS module"
sgrove 3:987ee333d593 11 *
sgrove 3:987ee333d593 12 * Example:
sgrove 3:987ee333d593 13 * @code
sgrove 3:987ee333d593 14 * #include "mbed.h"
sgrove 4:3f1a2b5dc176 15 * #include "GPS.h"
sgrove 4:3f1a2b5dc176 16 *
sgrove 4:3f1a2b5dc176 17 * DigitalOut led1(LED1);
sgrove 4:3f1a2b5dc176 18 * Serial pc(USBTX, USBRX);
sgrove 4:3f1a2b5dc176 19 * GPS gps(NC, p10);
sgrove 4:3f1a2b5dc176 20 *
sgrove 3:987ee333d593 21 * int main() {
sgrove 4:3f1a2b5dc176 22 * GPS_Time t;
sgrove 4:3f1a2b5dc176 23 *
sgrove 4:3f1a2b5dc176 24 * // Wait for the GPS NMEA data to become valid.
sgrove 4:3f1a2b5dc176 25 * while (!gps.isTimeValid()) {
sgrove 4:3f1a2b5dc176 26 * led1 = !led1;
sgrove 4:3f1a2b5dc176 27 * wait(1);
sgrove 3:987ee333d593 28 * }
sgrove 4:3f1a2b5dc176 29 *
sgrove 4:3f1a2b5dc176 30 * gps.timeNow(&t);
sgrove 4:3f1a2b5dc176 31 *
sgrove 4:3f1a2b5dc176 32 * pc.printf("The time/date is %02d:%02d:%02d %02d/%02d/%04d\r\n",
sgrove 4:3f1a2b5dc176 33 * t.hour, t.minute, t.second, t.day, t.month, t.year);
sgrove 4:3f1a2b5dc176 34 *
sgrove 4:3f1a2b5dc176 35 * // Wait until at least four satellites produce a position fix and a valid quality.
sgrove 4:3f1a2b5dc176 36 * while (gps.numOfSats() < 4 && gps.getGPSquality != 0) {
sgrove 4:3f1a2b5dc176 37 * led1 = !led1;
sgrove 4:3f1a2b5dc176 38 * wait(1);
sgrove 4:3f1a2b5dc176 39 * }
sgrove 4:3f1a2b5dc176 40 *
sgrove 4:3f1a2b5dc176 41 * pc.printf("Lat = %.4f Lon = %.4f Alt = %.1fkm\r\n",
sgrove 4:3f1a2b5dc176 42 * gps.latitude(), gps.longitude, gps.altitude());
sgrove 4:3f1a2b5dc176 43 *
sgrove 4:3f1a2b5dc176 44 * // Make the LED go steady to indicate we have finished.
sgrove 4:3f1a2b5dc176 45 * led1 = 1;
sgrove 4:3f1a2b5dc176 46 *
sgrove 4:3f1a2b5dc176 47 * while(1) {}
sgrove 3:987ee333d593 48 * }
sgrove 3:987ee333d593 49 * @endcode
sgrove 4:3f1a2b5dc176 50 */