Aaron Berk
/
CMPS03_HelloWorld
CMPS03 digital compass example.
main.cpp@0:83650aeac2b2, 2010-08-26 (annotated)
- Committer:
- aberk
- Date:
- Thu Aug 26 11:05:49 2010 +0000
- Revision:
- 0:83650aeac2b2
Version 1.0
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 | } |