一秒ごとにスイッチのon/off回数を数えるプログラムです。 タイムスタンプのエラーで困ってます。
Dependencies: Pswitch_Lib TextLCD mbed
Revision 0:252c31119664, committed 2014-02-09
- Comitter:
- nanaju
- Date:
- Sun Feb 09 12:59:04 2014 +0000
- Commit message:
- ????????????????????????????; ?????????????????
Changed in this revision
diff -r 000000000000 -r 252c31119664 Pswitch_Lib.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Pswitch_Lib.lib Sun Feb 09 12:59:04 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MBE13170/code/Pswitch_Lib/#a0eb75ae437f
diff -r 000000000000 -r 252c31119664 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sun Feb 09 12:59:04 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/carlos_nascimento08/code/TextLCD/#b8a17b39cd0d
diff -r 000000000000 -r 252c31119664 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 09 12:59:04 2014 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "Pswitch.h" + +TextLCD lcd(p24,p26,p27,p28,p29,p30); +DigitalOut myled(LED1); +Pswitch mgsw(p8); +Ticker wari; +LocalFileSystem local("local"); +int offset_JAPAN = 32400; //JSTのためのオフセット + +int main() {//unix timestamm +set_time(1391948455+offset_JAPAN); // Set RTC time to Mon, 18 Apr 2011 13:00:00 + +} + + +int rpm=0,count=0; +volatile bool flag; + +void time() { + flag=1; +} + +void LFS() { + char time[16]; +lcd.locate(0,0); + rpm=count*60/2; + time_t seconds; time(&seconds); + strftime(time, 16, "%H:%M:%S\n", localtime(&seconds)); + FILE *fp = fopen("/local/out.txt", "a"); + fprintf(fp,"rpm=%4d,count=%4d,%s",rpm,count,time); + fclose(fp); + lcd.printf ("count=%4d,%s\r\n",count,time); + count=0; +} + +int main2() { + wari.attach(&time, 1.0); + + while (1) { + if (mgsw.count()>0) { + + myled=1; + count++; + if (flag==1) { + LFS(); + flag=0; + } + } else { + myled=0; + } + //lcd.printf("%4d",count); + } +} \ No newline at end of file
diff -r 000000000000 -r 252c31119664 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 09 12:59:04 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479 \ No newline at end of file