Mark Horn
/
WITGyro
WITGyro
main.cpp@0:0d844f8ecb72, 2013-11-11 (annotated)
- Committer:
- marcuss421
- Date:
- Mon Nov 11 21:00:18 2013 +0000
- Revision:
- 0:0d844f8ecb72
Matt K
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcuss421 | 0:0d844f8ecb72 | 1 | #include "mbed.h" |
marcuss421 | 0:0d844f8ecb72 | 2 | #include "ITG3200.h" |
marcuss421 | 0:0d844f8ecb72 | 3 | #include "Terminal.h" |
marcuss421 | 0:0d844f8ecb72 | 4 | |
marcuss421 | 0:0d844f8ecb72 | 5 | Terminal term(USBTX, USBRX); |
marcuss421 | 0:0d844f8ecb72 | 6 | ITG3200 gyro(p9, p10); |
marcuss421 | 0:0d844f8ecb72 | 7 | |
marcuss421 | 0:0d844f8ecb72 | 8 | int main() |
marcuss421 | 0:0d844f8ecb72 | 9 | { |
marcuss421 | 0:0d844f8ecb72 | 10 | wait(1); |
marcuss421 | 0:0d844f8ecb72 | 11 | term.printf("Starting Gyro test... \n \r"); |
marcuss421 | 0:0d844f8ecb72 | 12 | gyro.setLpBandwidth(LPFBW_42HZ); |
marcuss421 | 0:0d844f8ecb72 | 13 | int x = 0; |
marcuss421 | 0:0d844f8ecb72 | 14 | int y = 0; |
marcuss421 | 0:0d844f8ecb72 | 15 | int z = 0; |
marcuss421 | 0:0d844f8ecb72 | 16 | while (1) |
marcuss421 | 0:0d844f8ecb72 | 17 | { |
marcuss421 | 0:0d844f8ecb72 | 18 | wait(0.2); |
marcuss421 | 0:0d844f8ecb72 | 19 | x = gyro.getGyroX(); |
marcuss421 | 0:0d844f8ecb72 | 20 | y = gyro.getGyroY(); |
marcuss421 | 0:0d844f8ecb72 | 21 | z = gyro.getGyroZ(); |
marcuss421 | 0:0d844f8ecb72 | 22 | term.printf("X-%i Y-%i Z-%i \n \r", x,y,z); |
marcuss421 | 0:0d844f8ecb72 | 23 | } |
marcuss421 | 0:0d844f8ecb72 | 24 | } |