Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:24267d7f2810, 2020-04-22 (annotated)
- Committer:
- psug
- Date:
- Wed Apr 22 15:31:14 2020 +0000
- Revision:
- 0:24267d7f2810
LAB2
;
Who changed what in which revision?
| User | Revision | Line number | New 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 |