problem 2 for HW 2

Dependencies:   4DGL-uLCD-SE 4180_LSM9DS0_lab LSM9DS0 mbed

Fork of 4180_LSM9DS0_lab by Allen Wild

Revision:
6:dbd765c256a2
Parent:
4:a9e3007530a7
--- a/main.cpp	Mon Feb 02 21:51:57 2015 +0000
+++ b/main.cpp	Wed Feb 18 14:50:45 2015 +0000
@@ -18,6 +18,7 @@
 // Verify that the pin assignments below match your breadboard
 LSM9DS0 imu(p9, p10, LSM9DS0_G_ADDR, LSM9DS0_XM_ADDR);
 Serial pc(USBTX, USBRX);
+Serial device(p13, p14);
 
 #ifdef PART_4
 uLCD_4DGL lcd(p28, p27, p30);X
@@ -47,7 +48,6 @@
 {
     setup();  //Setup sensor and Serial
     pc.printf("------ LSM0DS0 Demo -----------\n");
-
     while (true)
     {
     	// TODO - add code here to read compass or accelerometer data
@@ -59,7 +59,21 @@
     	//		float heading = imu.calcHeading();
     	// Remember that x = length*cos(heading) and y = length*sin(heading)
     	// to convert from degrees to radians (for sin/cos functions), multiply by pi/180
-		
+    	imu.readMag();
+		imu.readAccel();
+		imu.readTemp();
+		float heading = imu.calcHeading();
+        //if(device.readable()) {
+        //    pc.putc(device.getc());
+        //}
+		//if(pc.readable()) {
+        //    device.putc(pc.getc());
+        //}
+		pc.printf("Accelaration_x: %d\n", imu.ax_raw);
+		pc.printf("Accelaration_y: %d\n", imu.ay_raw);
+		pc.printf("Accelaration_z: %d\n", imu.az_raw);
+		pc.printf("Temperature in C: %2.4f\n", imu.temperature_c);
+		pc.printf("Heading: %2.4f\n", heading);
 		wait_ms(REFRESH_TIME_MS);
 	}
 }