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 app-board-USB-printf by
main.cpp@1:00053ea8a833, 2013-04-18 (annotated)
- Committer:
- chris
- Date:
- Thu Apr 18 13:13:04 2013 +0000
- Revision:
- 1:00053ea8a833
- Parent:
- 0:e762099aba67
First check in
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chris | 0:e762099aba67 | 1 | #include "mbed.h" |
| chris | 0:e762099aba67 | 2 | |
| chris | 0:e762099aba67 | 3 | AnalogIn pot1(p19); |
| chris | 0:e762099aba67 | 4 | DigitalOut myled(LED1); |
| chris | 0:e762099aba67 | 5 | |
| chris | 1:00053ea8a833 | 6 | LocalFileSystem fs("fs"); |
| chris | 1:00053ea8a833 | 7 | |
| chris | 0:e762099aba67 | 8 | int main() |
| chris | 0:e762099aba67 | 9 | { |
| chris | 0:e762099aba67 | 10 | |
| chris | 1:00053ea8a833 | 11 | FILE *fp = fopen("/fs/data.csv","w"); |
| chris | 1:00053ea8a833 | 12 | |
| chris | 0:e762099aba67 | 13 | for (int i=0; i < 100 ; i++) { |
| chris | 1:00053ea8a833 | 14 | fprintf(fp,"%.2f\n",pot1.read()); |
| chris | 0:e762099aba67 | 15 | wait(0.05); |
| chris | 0:e762099aba67 | 16 | myled = !myled; |
| chris | 0:e762099aba67 | 17 | } |
| chris | 1:00053ea8a833 | 18 | |
| chris | 1:00053ea8a833 | 19 | fclose(fp); |
| chris | 0:e762099aba67 | 20 | myled = 1; |
| chris | 0:e762099aba67 | 21 | |
| chris | 0:e762099aba67 | 22 | } |
