Gayané Langlois / Mbed 2 deprecated Binary_counter_with_mask

Dependencies:   mbed

Fork of bynary_counting_Hello_World by Emmanuel Boudoux

main.cpp

Committer:
Hikaria
Date:
2016-01-28
Revision:
1:77d533d0d869
Parent:
0:d6f93f0e46d4

File content as of revision 1:77d533d0d869:

#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 & 8) >> 3;
            b2=(counter & 4) >> 2;
            b1=(counter & 2) >> 1;
            b0=(counter & 0) >> 0;
            
            bitthree = b3;
            bittwo = b2;
            bitone = b1;
            bitzero = b0;

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