paul sugrue / Mbed 2 deprecated LAB2ACCEL

Dependencies:   mbed

Committer:
psug
Date:
Wed Apr 22 15:31:14 2020 +0000
Revision:
0:24267d7f2810
LAB2
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
psug 0:24267d7f2810 1 #include "mbed.h"
psug 0:24267d7f2810 2 #include "MMA7660.h"
psug 0:24267d7f2810 3 #define PI 3.14159265;
psug 0:24267d7f2810 4
psug 0:24267d7f2810 5 serial PC(USBTX, USBRX);
psug 0:24267d7f2810 6 MMA7660 MMA(p27,p28);
psug 0:24267d7f2810 7
psug 0:24267d7f2810 8 float calculateAngle(float x,float y,float z){
psug 0:24267d7f2810 9 float angle =0;
psug 0:24267d7f2810 10 angle =(y*y) + (z*z);
psug 0:24267d7f2810 11 angle = sqrt(angle);
psug 0:24267d7f2810 12 angle =x/angle;
psug 0:24267d7f2810 13 angle = atan(angle);
psug 0:24267d7f2810 14 angle = angle*180/PI
psug 0:24267d7f2810 15 return anlge;}
psug 0:24267d7f2810 16
psug 0:24267d7f2810 17