EES_2015 / Mbed 2 deprecated 4bit_binray_counter_using_switch

Dependencies:   DebounceIn mbed

main.cpp

Committer:
vjain419
Date:
2015-11-16
Revision:
1:0a9d678c6d6c
Parent:
0:74d1c03b0439

File content as of revision 1:0a9d678c6d6c:

#include "mbed.h"
#include "DebounceIn.h"
DigitalOut l1(LED1);
DigitalOut l2(LED2);
DigitalOut l3(LED3);
DigitalOut l4(LED4);
//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);
 
    while(1) {
      //  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;
        wait(1.0);
        count++;
//        old_pb = new_pb;
    }
}