sd & rtos & serial test
Dependencies: SDFileSystem mbed-rtos mbed
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include "SDFileSystem.h" 00004 00005 #define FILE_LOC "/sd/test.txt" 00006 00007 Serial pc(USBTX, USBRX); 00008 Serial gps(p28, p27); 00009 Serial test(p9,p10); 00010 SDFileSystem sd(p5, p6, p7, p8, "sd"); 00011 DigitalOut myled(LED1); 00012 DigitalOut sdled(LED2); 00013 00014 void sd_thread(void const *argument) { 00015 while(1){ 00016 sdled = !sdled; 00017 FILE *fp = NULL; 00018 fp = fopen(FILE_LOC, "w"); 00019 if( fp != NULL ) fclose(fp); 00020 Thread::wait(1000); 00021 } 00022 } 00023 00024 int main() { 00025 00026 Thread sdTask(sd_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE * 2.25); 00027 while(1) { 00028 myled = !myled; 00029 Thread::wait(1000); 00030 } 00031 }
Generated on Thu Jul 21 2022 23:34:14 by 1.7.2