Aaron Berk
/
CMPS03_HelloWorld
CMPS03 digital compass example.
main.cpp@1:3eeda0cce598, 2010-11-27 (annotated)
- Committer:
- aberk
- Date:
- Sat Nov 27 12:11:04 2010 +0000
- Revision:
- 1:3eeda0cce598
- Parent:
- 0:83650aeac2b2
Uses libraries for imports (as opposed to programs).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aberk | 0:83650aeac2b2 | 1 | #include "CMPS03.h" |
aberk | 0:83650aeac2b2 | 2 | |
aberk | 0:83650aeac2b2 | 3 | CMPS03 compass(p9, p10, CMPS03_DEFAULT_I2C_ADDRESS); |
aberk | 0:83650aeac2b2 | 4 | Serial pc(USBTX, USBRX); |
aberk | 0:83650aeac2b2 | 5 | |
aberk | 0:83650aeac2b2 | 6 | int main() { |
aberk | 0:83650aeac2b2 | 7 | |
aberk | 0:83650aeac2b2 | 8 | pc.printf("Starting CMPS03 test...\n"); |
aberk | 0:83650aeac2b2 | 9 | |
aberk | 0:83650aeac2b2 | 10 | while(1){ |
aberk | 0:83650aeac2b2 | 11 | |
aberk | 0:83650aeac2b2 | 12 | wait(0.1); |
aberk | 0:83650aeac2b2 | 13 | |
aberk | 0:83650aeac2b2 | 14 | pc.printf("Bearing is: %f\n", compass.readBearing() / 10.0); |
aberk | 0:83650aeac2b2 | 15 | |
aberk | 0:83650aeac2b2 | 16 | } |
aberk | 0:83650aeac2b2 | 17 | |
aberk | 0:83650aeac2b2 | 18 | } |