GPS and Compass update every1 sec

Dependencies:   HMC6352 mbed

Files at this revision

API Documentation at this revision

Comitter:
airaylee
Date:
Mon Dec 02 22:21:20 2013 +0000
Parent:
0:b28303f602dc
Child:
2:e70394e9c959
Commit message:
Ver1.2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Nov 17 22:17:18 2013 +0000
+++ b/main.cpp	Mon Dec 02 22:21:20 2013 +0000
@@ -3,23 +3,23 @@
 #include "GPS.h"
 
 //HMC6352 use an I2C interface so we here have scl-p27 and sda-28 
-//BR-355 GPS use serial port p10-RX
+//BR-355 GPS use serial port p14-RX
 HMC6352 compass(p28, p27);
 Serial pc(USBTX, USBRX);
-GPS gps(p9, p10);
+GPS gps(p13, p14);
 
 int main() {
-    pc.printf("Starting HMC6352 test...\n");
+    pc.printf("Starting\n");
     //Continuous mode, periodic set/reset, 20Hz measurement rate.
     compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);
     while (1) {
         wait(1);
-        pc.printf("The compass Heading is: %f\n", compass.sample() / 10.0);
+        pc.printf("compass:%f,", compass.sample() / 10.0);
         if(gps.sample()){
-            pc.printf("I'm at %f, %f\n", gps.longitude, gps.latitude);
+            pc.printf("GPS:%f,%f\n", gps.longitude, gps.latitude);
         }
         else{
-            pc.printf("Oh, no signal......");
+            pc.printf("No\n");
         }
     }
 }