Gayané Langlois / Mbed 2 deprecated Binary_counter_with_mask

Dependencies:   mbed

Fork of bynary_counting_Hello_World by Emmanuel Boudoux

main.cpp

Committer:
xeryus1206
Date:
2010-12-07
Revision:
0:d6f93f0e46d4
Child:
1:77d533d0d869

File content as of revision 0:d6f93f0e46d4:

#include "mbed.h"

DigitalOut bitzero(LED1);
DigitalOut bitone(LED2);
DigitalOut bittwo(LED3);
DigitalOut bitthree(LED4);

int main() {

    int counter;
    int b3,b2,b1,b0;

    while (1) {
        for (counter = 0; counter < 16; counter++) {

            b3=(counter > 7);
            b2=((counter-(b3*8)) > 3);
            b1=((counter-(b3*8)-(b2*4)) > 1);
            b0=((counter-(b3*8)-(b2*4)-(b1*2)) > 0);
            
            bitthree = b3;
            bittwo = b2;
            bitone = b1;
            bitzero = b0;

            wait(0.5);
        }
        counter = 0;
    }
}