Aaron Berk
/
ITG3200_HelloWorld
ITG-3200 triple axis, digital gyroscope example.
main.cpp@0:4d5987f27ca4, 2010-08-03 (annotated)
- Committer:
- aberk
- Date:
- Tue Aug 03 13:10:51 2010 +0000
- Revision:
- 0:4d5987f27ca4
- Child:
- 1:6a040ee9e40b
Version 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aberk | 0:4d5987f27ca4 | 1 | #include "ITG3200.h" |
aberk | 0:4d5987f27ca4 | 2 | |
aberk | 0:4d5987f27ca4 | 3 | Serial pc(USBTX, USBRX); |
aberk | 0:4d5987f27ca4 | 4 | ITG3200 gyro(p9, p10); |
aberk | 0:4d5987f27ca4 | 5 | |
aberk | 0:4d5987f27ca4 | 6 | int main() { |
aberk | 0:4d5987f27ca4 | 7 | |
aberk | 0:4d5987f27ca4 | 8 | pc.printf("Now starting ITG-3200 test...\n"); |
aberk | 0:4d5987f27ca4 | 9 | |
aberk | 0:4d5987f27ca4 | 10 | //Set highest bandwidth. |
aberk | 0:4d5987f27ca4 | 11 | gyro.setLpBandwidth(LPFBW_256HZ); |
aberk | 0:4d5987f27ca4 | 12 | |
aberk | 0:4d5987f27ca4 | 13 | while (1) { |
aberk | 0:4d5987f27ca4 | 14 | |
aberk | 0:4d5987f27ca4 | 15 | //Arbitrary wait for printf clarity. |
aberk | 0:4d5987f27ca4 | 16 | wait(0.1); |
aberk | 0:4d5987f27ca4 | 17 | pc.printf("%f, %f, %f\n", gyro.getGyroX(), |
aberk | 0:4d5987f27ca4 | 18 | gyro.getGyroY(), gyro.getGyroZ()); |
aberk | 0:4d5987f27ca4 | 19 | |
aberk | 0:4d5987f27ca4 | 20 | } |
aberk | 0:4d5987f27ca4 | 21 | |
aberk | 0:4d5987f27ca4 | 22 | } |