![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First issue to MK
Dependencies: mbed QEI LM75B C12832_lcd2 FatFileSystem MSCFileSystem
main.cpp@0:22a5db2c7926, 2012-07-23 (annotated)
- Committer:
- chris
- Date:
- Mon Jul 23 09:35:54 2012 +0000
- Revision:
- 0:22a5db2c7926
- Child:
- 2:c887cf1c3ed9
Working with new Compiler repos;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:22a5db2c7926 | 1 | #include "mbed.h" |
chris | 0:22a5db2c7926 | 2 | #include "MSCFileSystem.h" |
chris | 0:22a5db2c7926 | 3 | |
chris | 0:22a5db2c7926 | 4 | MSCFileSystem sd("sd"); |
chris | 0:22a5db2c7926 | 5 | |
chris | 0:22a5db2c7926 | 6 | |
chris | 0:22a5db2c7926 | 7 | DigitalOut led1(LED1); |
chris | 0:22a5db2c7926 | 8 | DigitalOut led2(LED2); |
chris | 0:22a5db2c7926 | 9 | DigitalOut led3(LED3); |
chris | 0:22a5db2c7926 | 10 | DigitalOut led4(LED4); |
chris | 0:22a5db2c7926 | 11 | |
chris | 0:22a5db2c7926 | 12 | int main() { |
chris | 0:22a5db2c7926 | 13 | |
chris | 0:22a5db2c7926 | 14 | printf("This is version 1.0 of the USB host test\n"); |
chris | 0:22a5db2c7926 | 15 | |
chris | 0:22a5db2c7926 | 16 | FILE *fp = fopen("/sd/test.txt","w"); |
chris | 0:22a5db2c7926 | 17 | printf("Create filehandle\n"); |
chris | 0:22a5db2c7926 | 18 | |
chris | 0:22a5db2c7926 | 19 | led1= 1; |
chris | 0:22a5db2c7926 | 20 | |
chris | 0:22a5db2c7926 | 21 | if (fp == NULL) { //make sure it's been opened |
chris | 0:22a5db2c7926 | 22 | printf("its bad :-(\n"); |
chris | 0:22a5db2c7926 | 23 | led2 = 1; |
chris | 0:22a5db2c7926 | 24 | exit(1); |
chris | 0:22a5db2c7926 | 25 | } |
chris | 0:22a5db2c7926 | 26 | printf("its good :-)\n"); |
chris | 0:22a5db2c7926 | 27 | |
chris | 0:22a5db2c7926 | 28 | led3 = 1; |
chris | 0:22a5db2c7926 | 29 | |
chris | 0:22a5db2c7926 | 30 | fprintf(fp,"Hello world!\n"); |
chris | 0:22a5db2c7926 | 31 | printf("Write to the file\n"); |
chris | 0:22a5db2c7926 | 32 | |
chris | 0:22a5db2c7926 | 33 | |
chris | 0:22a5db2c7926 | 34 | fclose(fp); |
chris | 0:22a5db2c7926 | 35 | printf("Close the handle\n"); |
chris | 0:22a5db2c7926 | 36 | |
chris | 0:22a5db2c7926 | 37 | led4 = 1; |
chris | 0:22a5db2c7926 | 38 | printf("\n"); |
chris | 0:22a5db2c7926 | 39 | } |