Project group 3
/
mbed_cmp
The compass part
Fork of mbed_cmp by
main.cpp@0:2f8627e2b4c7, 2016-02-29 (annotated)
- Committer:
- gegjackson
- Date:
- Mon Feb 29 15:11:21 2016 +0000
- Revision:
- 0:2f8627e2b4c7
- Child:
- 1:5b42fa6e0a73
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gegjackson | 0:2f8627e2b4c7 | 1 | #include "CMPS03.h" |
gegjackson | 0:2f8627e2b4c7 | 2 | #include "mbed.h" |
gegjackson | 0:2f8627e2b4c7 | 3 | CMPS03 compass(p9, p10, CMPS03_DEFAULT_I2C_ADDRESS); |
gegjackson | 0:2f8627e2b4c7 | 4 | Serial pc(USBTX, USBRX); |
gegjackson | 0:2f8627e2b4c7 | 5 | |
gegjackson | 0:2f8627e2b4c7 | 6 | int main() { |
gegjackson | 0:2f8627e2b4c7 | 7 | |
gegjackson | 0:2f8627e2b4c7 | 8 | pc.printf("Starting CMPS03 test...\n"); |
gegjackson | 0:2f8627e2b4c7 | 9 | |
gegjackson | 0:2f8627e2b4c7 | 10 | while(1){ |
gegjackson | 0:2f8627e2b4c7 | 11 | |
gegjackson | 0:2f8627e2b4c7 | 12 | wait(0.1); |
gegjackson | 0:2f8627e2b4c7 | 13 | |
gegjackson | 0:2f8627e2b4c7 | 14 | pc.printf("Bearing is: %f\n", compass.readBearing() / 10.0); |
gegjackson | 0:2f8627e2b4c7 | 15 | |
gegjackson | 0:2f8627e2b4c7 | 16 | } |
gegjackson | 0:2f8627e2b4c7 | 17 | |
gegjackson | 0:2f8627e2b4c7 | 18 | } |