lab question 2

Dependencies:   mbed C12832_lcd MMA7660 ttmath

Revision:
0:7cd973be7a0a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 21 11:54:31 2019 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "MMA7660.h"
+
+Serial pc(USBTX,USBRX);
+MMA7660 MMA(p28, p27);
+
+
+float calculateAngle(float x, float y, float z)
+        {
+            float angle = 0;
+            angle= (atan(x/sqrt((y*y)+(z*z))))*180.0/ 3.14159265;
+            return angle;
+            
+        }
+         int main()
+            {
+                while (1)
+                {
+                    pc.printf("x%f, y%f, z%f, ang%f\n\r",MMA.x(),MMA.y(),MMA.z(),calculateAngle(MMA.x(),MMA.y(),MMA.z()));
+                    wait(1);
+                }
+            }
+                
\ No newline at end of file