Unit testing and development for 9DOF sparkfun sensor stick
Dependencies: ADXL345 HMC5883L ITG3200 mbed
Revision 5:63b115f85aa7, committed 2012-11-09
- Comitter:
- tylerjw
- Date:
- Fri Nov 09 18:33:29 2012 +0000
- Parent:
- 4:8a77e21d08f1
- Commit message:
- ITG3200 curve fit test
Changed in this revision
ITG3200.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8a77e21d08f1 -r 63b115f85aa7 ITG3200.lib --- a/ITG3200.lib Tue Nov 06 19:06:58 2012 +0000 +++ b/ITG3200.lib Fri Nov 09 18:33:29 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/tylerjw/code/ITG3200/#e886466d7d67 +http://mbed.org/users/tylerjw/code/ITG3200/#e61fe4b74daa
diff -r 8a77e21d08f1 -r 63b115f85aa7 main.cpp --- a/main.cpp Tue Nov 06 19:06:58 2012 +0000 +++ b/main.cpp Fri Nov 09 18:33:29 2012 +0000 @@ -29,10 +29,11 @@ //ADXL345UNIT accel_test(i2c_bus, t); void sample_time_test(); +void itg3200_curve_test(); int main() { - sample_time_test(); + itg3200_curve_test(); } void sample_time_test() @@ -127,11 +128,14 @@ DigitalOut myled(LED1); LocalFileSystem local("local"); // Create the local filesystem under the name "local" ITG3200 gyro(p28, p27); // sda, scl - gyro + + /* const float offset[3] = {99.5, -45.0, -29.7}; // taken from itg3200.xls curve fit test const float slope[3] = {-1.05, 0.95, 0.47}; gyro.setCalibrationCurve(offset, slope); - gyro.setLpBandwidth(LPFBW_5HZ); // lowest rate low-pass filter + gyro.setLpBandwidth(LPFBW_42HZ); + */ Serial pc(USBTX, USBRX); @@ -146,11 +150,10 @@ for(int i = 0; i < 120; i++) { // 120 seconds - 600 samples myled = 1; - //gyro.calibrate(1.0); - wait(0.5); + gyro.calibrate(1.0); myled = 0; - gyro.getXYZ(gyro_readings, ITG3200::Calibration); - //gyro.getOffset(gyro_readings); + //gyro.getXYZ(gyro_readings, ITG3200::Calibration); + gyro.getOffset(gyro_readings); temperature = gyro.getTemperature(); pc.printf("%3d,%f,%d,%d,%d\r\n",i,temperature,gyro_readings[0],gyro_readings[1],gyro_readings[2]); fprintf(fp, "%f,%d,%d,%d\r\n",temperature,gyro_readings[0],gyro_readings[1],gyro_readings[2]);