EES_2015 / Mbed 2 deprecated 4bit_binray_counter_using_switch

Dependencies:   DebounceIn mbed

Files at this revision

API Documentation at this revision

Comitter:
vjain419
Date:
Mon Nov 16 13:33:56 2015 +0000
Parent:
0:74d1c03b0439
Commit message:
without switch counter

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Nov 16 12:29:51 2015 +0000
+++ b/main.cpp	Mon Nov 16 13:33:56 2015 +0000
@@ -4,25 +4,27 @@
 DigitalOut l2(LED2);
 DigitalOut l3(LED3);
 DigitalOut l4(LED4);
-DebounceIn   pb(p8);
+//DebounceIn   pb(p8);
 // SPST Pushbutton demo using internal PullUp function
 // no external PullUp resistor needed
 // Pushbutton from P8 to GND.
 int main() {
     int count=0;
-    int old_pb=1;
-    int new_pb;
-    pb.mode(PullUp);
-    wait(0.01);
+//    int old_pb=1;
+//    int new_pb;
+//    pb.mode(PullUp);
+//    wait(0.01);
  
     while(1) {
-        new_pb = pb;
-        if((new_pb == 0) & (old_pb ==1))
-            count++;
+      //  new_pb = pb;
+//        if((new_pb == 0) & (old_pb ==1))
+//            count++;
         l4 = count & 0x01;
         l3 = (count & 0x02) >> 1;
         l2 = (count & 0x04) >> 2;
         l1 = (count & 0x08) >> 3;
-        old_pb = new_pb;
+        wait(1.0);
+        count++;
+//        old_pb = new_pb;
     }
 }
\ No newline at end of file