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.
Fork of MMA7660_HelloWorld by
Revision 3:f23f1ba7aeaa, committed 2017-04-05
- Comitter:
- ogris
- Date:
- Wed Apr 05 08:54:40 2017 +0000
- Parent:
- 2:0af77f74afb2
- Commit message:
- sadfawer
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue May 13 18:15:06 2014 +0000 +++ b/main.cpp Wed Apr 05 08:54:40 2017 +0000 @@ -4,18 +4,29 @@ #include "MMA7660.h" MMA7660 MMA(p28, p27); +Serial pc(USBTX,USBRX); + DigitalOut connectionLed(LED1); -PwmOut Zaxis_p(LED2); -PwmOut Zaxis_n(LED3); int main() { - if (MMA.testConnection()) - connectionLed = 1; +float x=0,y=0,z=0; + pc.baud(115200); + if (MMA.testConnection()){ + connectionLed = 1; + pc.printf("connected \n"); + } + while(1) { - Zaxis_p = MMA.z(); - Zaxis_n = -MMA.z(); + x += MMA.x(); + y += MMA.y(); + z += MMA.z(); + x = x/2; + y = y/2; + z = z/2; + pc.printf(":%lf;%lf;%lf\n",x,y,z); + wait_ms(100); } }