test

Dependencies:   mbed

Committer:
ryosuke
Date:
Fri Jun 21 11:08:49 2013 +0000
Revision:
0:d1f69bf9cfa4
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ryosuke 0:d1f69bf9cfa4 1 #include "ITG3200.h"
ryosuke 0:d1f69bf9cfa4 2 #include "mbed.h"
ryosuke 0:d1f69bf9cfa4 3
ryosuke 0:d1f69bf9cfa4 4 Timer t;
ryosuke 0:d1f69bf9cfa4 5 Serial pc(USBTX, USBRX);
ryosuke 0:d1f69bf9cfa4 6 ITG3200 gyro(p9, p10);
ryosuke 0:d1f69bf9cfa4 7
ryosuke 0:d1f69bf9cfa4 8
ryosuke 0:d1f69bf9cfa4 9 int main() {
ryosuke 0:d1f69bf9cfa4 10
ryosuke 0:d1f69bf9cfa4 11
ryosuke 0:d1f69bf9cfa4 12 pc.printf("Now starting ITG-3200 test\n");
ryosuke 0:d1f69bf9cfa4 13 //gyro1.setWhoAmI(0x6b);
ryosuke 0:d1f69bf9cfa4 14 wait(0.01);
ryosuke 0:d1f69bf9cfa4 15 pc.printf("ID is :0x%02x\n",gyro1.getWhoAmI());
ryosuke 0:d1f69bf9cfa4 16 //Set highest bandwidth.
ryosuke 0:d1f69bf9cfa4 17 gyro1.setLpBandwidth(LPFBW_42HZ);
ryosuke 0:d1f69bf9cfa4 18
ryosuke 0:d1f69bf9cfa4 19 //Arbitrary wait for printf clarity.
ryosuke 0:d1f69bf9cfa4 20
ryosuke 0:d1f69bf9cfa4 21 wait(0.1);
ryosuke 0:d1f69bf9cfa4 22 t.start();
ryosuke 0:d1f69bf9cfa4 23 while (1) {
ryosuke 0:d1f69bf9cfa4 24
ryosuke 0:d1f69bf9cfa4 25 pc.printf("%i, %i, %i\n\r", gyro1.getGyroX(), gyro1.getGyroY(), gyro1.getGyroZ());
ryosuke 0:d1f69bf9cfa4 26
ryosuke 0:d1f69bf9cfa4 27 }
ryosuke 0:d1f69bf9cfa4 28
ryosuke 0:d1f69bf9cfa4 29 }