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.
Dependencies: C12832 MMA7660 mbed
main.cpp@0:434201e2c3c2, 2018-11-16 (annotated)
- Committer:
- Bleiz038
- Date:
- Fri Nov 16 12:02:49 2018 +0000
- Revision:
- 0:434201e2c3c2
d
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Bleiz038 | 0:434201e2c3c2 | 1 | #include "mbed.h" |
| Bleiz038 | 0:434201e2c3c2 | 2 | #include "MMA7660.h" |
| Bleiz038 | 0:434201e2c3c2 | 3 | #include "C12832.h" |
| Bleiz038 | 0:434201e2c3c2 | 4 | |
| Bleiz038 | 0:434201e2c3c2 | 5 | LocalFileSystem local("local"); |
| Bleiz038 | 0:434201e2c3c2 | 6 | MMA7660 MMA(p28, p27); |
| Bleiz038 | 0:434201e2c3c2 | 7 | int W=0; |
| Bleiz038 | 0:434201e2c3c2 | 8 | DigitalOut Y(LED1); |
| Bleiz038 | 0:434201e2c3c2 | 9 | float x = 0; |
| Bleiz038 | 0:434201e2c3c2 | 10 | float y = 0; |
| Bleiz038 | 0:434201e2c3c2 | 11 | float z = 0; |
| Bleiz038 | 0:434201e2c3c2 | 12 | |
| Bleiz038 | 0:434201e2c3c2 | 13 | int main() { |
| Bleiz038 | 0:434201e2c3c2 | 14 | FILE *fp = fopen("local/mesures.csv","w"); |
| Bleiz038 | 0:434201e2c3c2 | 15 | if (MMA.testConnection()) |
| Bleiz038 | 0:434201e2c3c2 | 16 | for (W=0;W<100;W=W++){ |
| Bleiz038 | 0:434201e2c3c2 | 17 | x= MMA.x(); |
| Bleiz038 | 0:434201e2c3c2 | 18 | y= MMA.y(); |
| Bleiz038 | 0:434201e2c3c2 | 19 | z= MMA.z(); |
| Bleiz038 | 0:434201e2c3c2 | 20 | fprintf(fp,"%d;%f;%f;%f;\n",W,x,y,z); |
| Bleiz038 | 0:434201e2c3c2 | 21 | Y=1; |
| Bleiz038 | 0:434201e2c3c2 | 22 | wait(0.1); |
| Bleiz038 | 0:434201e2c3c2 | 23 | Y=0; |
| Bleiz038 | 0:434201e2c3c2 | 24 | } |
| Bleiz038 | 0:434201e2c3c2 | 25 | fclose(fp); |
| Bleiz038 | 0:434201e2c3c2 | 26 | } |