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: SDFileSystem mbed
main.cpp
00001 #include "mbed.h" 00002 #include "Log.h" 00003 00004 DigitalIn mybutton(USER_BUTTON); 00005 Serial pc(SERIAL_TX, SERIAL_RX); 00006 00007 Log logger(SERIAL_TX, SERIAL_RX, SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, "sd"); 00008 00009 Ticker timer; 00010 void Int_Timer(); 00011 static double t; 00012 00013 int main() { 00014 /** ログのタイトル行 **/ 00015 char* str="time,button\n"; 00016 if(!(logger.initialize_sdlog(str))){ 00017 return 0; 00018 } 00019 00020 // printf("Start!\n"); 00021 timer.attach(&Int_Timer, 0.1); 00022 00023 t = 0.0; 00024 while(1){ 00025 if(t > 10.0){ 00026 timer.detach(); 00027 break; 00028 } 00029 } 00030 00031 logger.close(); 00032 printf("Finish!\n"); 00033 } 00034 00035 00036 void Int_Timer() { 00037 char buf[20]; 00038 /** ログをとりたい値を記入 **/ 00039 sprintf(buf, "%.1f,%d\n", t, (int)mybutton); 00040 logger.puts(buf); 00041 t += 0.1; 00042 }
Generated on Tue Jul 12 2022 18:37:36 by
1.7.2