Enpra_practice12

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ogata_lab
Date:
Thu Jul 04 03:25:30 2013 +0000
Commit message:
First Commit;

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 0c2f82ec4865 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 04 03:25:30 2013 +0000
@@ -0,0 +1,24 @@
+
+#include "mbed.h"
+#include "Serial.h"
+
+DigitalIn sw01(p20);
+Serial usbSerial(USBTX, USBRX);
+
+bool old_sw = false;
+
+int main() {
+
+    sw01.mode(PullUp);
+    usbSerial.printf("Hello World!");
+    int i = 0;
+    while(1) {
+        bool new_sw = sw01;
+        if(new_sw && !old_sw) {
+           i++;
+        }
+        usbSerial.printf("Counter = %d¥r¥n", i);
+        old_sw = new_sw;
+        
+    }
+}
diff -r 000000000000 -r 0c2f82ec4865 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 04 03:25:30 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file