johan yapson / Mbed 2 deprecated Nucleof446_counter

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rtandil
Date:
Mon Mar 06 10:41:39 2017 +0000
Parent:
0:99aabdc13d25
Commit message:
First commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 99aabdc13d25 -r cbdba17a7bd5 main.cpp
--- a/main.cpp	Thu Mar 02 02:53:49 2017 +0000
+++ b/main.cpp	Mon Mar 06 10:41:39 2017 +0000
@@ -1,8 +1,7 @@
 #include "mbed.h"
 
-DigitalIn count(D2);
-
-int i = 0;
+DigitalIn count(USER_BUTTON);
+DigitalOut myled(LED1);
 int main() 
 {
     while(1) 
@@ -10,12 +9,15 @@
         
         if (count == 1)
         {
+             wait_ms(100);
              if (count == 0)
              {
-                i++;
-                printf("barang = %d\n",i);
-             }   
+                myled = 1;
+             }
+             else
+             {
+                 myled = 0;
+            }   
         }
-        
     }
 }