This simply counts from 0-15 continuously, displaying the binary value using the LED\'s along the bottom of the mbed.

Dependencies:   mbed

main.cpp

Committer:
chrisvarns
Date:
2011-06-24
Revision:
0:06901945ebc5

File content as of revision 0:06901945ebc5:

#include "mbed.h"

DigitalOut l1(LED1);
DigitalOut l2(LED2);
DigitalOut l3(LED3);
DigitalOut l4(LED4);

#define D() wait(0.5)

int main() {

    int count = 0;
    while (1)
    {
        if (count & 0x08) l1 = 1;
        if (count & 0x04) l2 = 1;
        if (count & 0x02) l3 = 1;
        if (count & 0x01) l4 = 1;
        
        D();
        l1=l2=l3=l4=0;
        if (count==15) count = 0;
        else count++;
    }

}