Allan Li
/
Final_Demo
GPS and Compass update every1 sec
Revision 0:b28303f602dc, committed 2013-11-17
- Comitter:
- airaylee
- Date:
- Sun Nov 17 22:17:18 2013 +0000
- Child:
- 1:ce62180e1576
- Commit message:
- For ECE4180 Final Project
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GPS.lib Sun Nov 17 22:17:18 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/simon/code/GPS/#15611c7938a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HMC6352.lib Sun Nov 17 22:17:18 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/aberk/code/HMC6352/#83c0cb554099
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 17 22:17:18 2013 +0000 @@ -0,0 +1,26 @@ +#include "HMC6352.h" +#include "mbed.h" +#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 +HMC6352 compass(p28, p27); +Serial pc(USBTX, USBRX); +GPS gps(p9, p10); + +int main() { + pc.printf("Starting HMC6352 test...\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); + if(gps.sample()){ + pc.printf("I'm at %f, %f\n", gps.longitude, gps.latitude); + } + else{ + pc.printf("Oh, no signal......"); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 17 22:17:18 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file