Vigneshwar Murali / Mbed 2 deprecated 6DoF_IMU_readvalue_thingy

Dependencies:   ITG3200 mbed

Fork of 6DoF_IMU_readvalue by Ryo Nakabayashi

Files at this revision

API Documentation at this revision

Comitter:
Vigneshwar
Date:
Tue Feb 12 02:31:21 2013 +0000
Parent:
0:cda6d9f5a43c
Child:
2:39468ef68358
Commit message:
Final Version

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
--- a/ITG3200.lib	Mon Nov 26 05:34:56 2012 +0000
+++ b/ITG3200.lib	Tue Feb 12 02:31:21 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/aberk/code/ITG3200/#b098d99dd81e
+http://mbed.org/users/Digixx/code/ITG3200/#8967cbe04d96
--- a/main.cpp	Mon Nov 26 05:34:56 2012 +0000
+++ b/main.cpp	Tue Feb 12 02:31:21 2013 +0000
@@ -2,15 +2,17 @@
 #include "ADXL345_I2C.h"
 
 Serial pc(USBTX, USBRX);
-ITG3200 gyro(p9, p10);
-ADXL345_I2C accel(p9, p10);
+ITG3200 gyro(p28, p27);
+ADXL345_I2C accel(p28, p27);
 
 int main() {
+    char str[512];
     gyro.setWhoAmI(0x68);
     pc.printf("Now starting 6-degrees-of-freedom (ITG-3200 ADXL345) test...\n");
     pc.printf("Accelerometer Device ID is: 0x%02x\n", accel.getDeviceID());
-    pc.printf("Gyro Devide ID is: 0x02x\n", gyro.getWhoAmI());
-    
+    pc.printf("Gyro Devide ID is: 0x%02x\n", gyro.getWhoAmI());
+     
+     
     int accel_read[3] = {0, 0, 0};
     
     // Accel setup
@@ -42,14 +44,21 @@
     // Gyro setup   
     gyro.setLpBandwidth(LPFBW_42HZ);
 
-    while (1) {
+    while (1)
+    {
         wait(0.1);
         
         accel.getOutput(accel_read);
         
-        pc.printf("Gyro[%5i, %5i, %5i]   Accel[%4i, %4i, %4i]\n", 
+        sprintf(str, "%i,%i,%i,%i,%i,%i,%i\n", (int16_t)accel_read[0], (int16_t)accel_read[1], (int16_t)accel_read[2],
+                                                     gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ(), (int16_t)gyro.getTemperature());  
+        pc.printf(str);
+        
+        /*
+        pc.printf("Gyro[%5i, %5i, %5i]   Accel[%4i, %4i, %4i]\n\t", 
                             gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ(),
                             (int16_t)accel_read[0], (int16_t)accel_read[1], (int16_t)accel_read[2]);
+        */
     }
     
 }