PCシリアルサンプルプログラム mbedセミナー演習2ex

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
diff -r 000000000000 -r c886b74709da main.cpp
--- /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;
+    }
+}
diff -r 000000000000 -r c886b74709da mbed.bld
--- /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