Simple binary upcounter

Dependencies:   mbed

main.cpp

Committer:
Lerche
Date:
2009-12-03
Revision:
0:d5c405727b8d

File content as of revision 0:d5c405727b8d:

// 4 bit binary counter, using onboard LEDs
#include "mbed.h"

unsigned char i;                                        // Make variable "i" a char (8bit)

BusOut leds(LED4, LED3, LED2, LED1);                    // Create a BusOut variable "leds", with LED1-4

int main() {                                            // Main structure
    while(1) {                                          // While-loop (Do forever)
        leds = leds+1;                                  // Every loop, add one to leds variable
        wait(0.5);                                      // Wait for .5 seconds
    }                                                   // End of While-loop
}                                                       // End of Main structure