Junichi Katsu
/
PCSerialDitalIn_test
PCシリアルサンプルプログラム mbedセミナー演習2ex
Revision 0:c886b74709da, committed 2011-08-26
- Comitter:
- jksoft
- Date:
- Fri Aug 26 15:37:17 2011 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 26 15:37:17 2011 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx +DigitalIn sw(p5); + +int main() { + int old = sw; + int count = 0; + + sw.mode(PullUp); + + pc.printf("Counter!"); + + while(1) { + if((sw == 0)&&(old == 1)) + { + count++; + printf("%d\r\n",count); + wait(0.2); + } + old = sw; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Aug 26 15:37:17 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912