test
Dependencies: SDFileSystem USBHost_SAMPLE mbed
Fork of Production_version1_0 by
Revision 2:c34453addfec, committed 2017-11-07
- Comitter:
- SampleProgram
- Date:
- Tue Nov 07 00:25:56 2017 +0000
- Parent:
- 1:16b9397301c6
- Commit message:
- test;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 16b9397301c6 -r c34453addfec main.cpp --- a/main.cpp Thu Sep 28 01:34:14 2017 +0000 +++ b/main.cpp Tue Nov 07 00:25:56 2017 +0000 @@ -6,17 +6,15 @@ SDFileSystem sd(p5, p6, p7, p8, "sd"); int i=0; - void onKey(uint8_t key) { - printf("Key: %c\r\n", key); - char log[8]; - ++i; + printf("Key: 0x%x : %c\r\n", key, key); + ++i; FILE *fp; - sprintf(log, "log%03d.csv", i); - fp = fopen("log", "a"); - fprintf(fp, "Keydata[%d],:,%c\r\n", i, key); + fp = fopen("/sd/keylog/keylog.csv", "a"); + fprintf(fp, "Keydata[%d], :,0x%x,:,%c\r\n", i, key, key); fclose(fp); + } void keyboard_task(void const *) { @@ -40,13 +38,11 @@ int main() { mkdir("/sd/keylog", 0777); FILE *fp; - fp = fopen("/sd/keylog/log.csv","w"); + fp = fopen("/sd/keylog/keylog.csv","w"); fclose(fp); - Thread keyboardTask(keyboard_task, NULL, osPriorityNormal, 256 * 4); - - while(1) { + while(1) { led=!led; Thread::wait(500); }