Frank Doherty
/
Interrupt
Interrupt Lab
main.cpp
- Committer:
- FrankDoherty86
- Date:
- 2019-05-24
- Revision:
- 1:82217c93a7dd
- Parent:
- 0:82470c7cda3a
File content as of revision 1:82217c93a7dd:
//Using measured acceleration to run Led 2 and Led 3 on the Mbed// #include "mbed.h" #include "MMA7660.h" Serial pc(USBTX, USBRX); //tx rx MMA7660 MMA(p28, p27); float calculateAngle (float x, float y, float z) { float angle = 0; angle = (atan (x/ sqrt((y*y)+(z*z))*180/3.17); return angle; } int main() { //if MMA.test connection () )// while (1) { print.f("x %f, y %f, z %f ang %f\n", MMA.x(), MMA.y(), MMA.z(), calculateAngle(MMA.x(),MMA.y(),MMA.z())); wait(1); } }