Simple binary upcounter

Dependencies:   mbed

Committer:
Lerche
Date:
Thu Dec 03 09:59:13 2009 +0000
Revision:
0:d5c405727b8d

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lerche 0:d5c405727b8d 1 // 4 bit binary counter, using onboard LEDs
Lerche 0:d5c405727b8d 2 #include "mbed.h"
Lerche 0:d5c405727b8d 3
Lerche 0:d5c405727b8d 4 unsigned char i; // Make variable "i" a char (8bit)
Lerche 0:d5c405727b8d 5
Lerche 0:d5c405727b8d 6 BusOut leds(LED4, LED3, LED2, LED1); // Create a BusOut variable "leds", with LED1-4
Lerche 0:d5c405727b8d 7
Lerche 0:d5c405727b8d 8 int main() { // Main structure
Lerche 0:d5c405727b8d 9 while(1) { // While-loop (Do forever)
Lerche 0:d5c405727b8d 10 leds = leds+1; // Every loop, add one to leds variable
Lerche 0:d5c405727b8d 11 wait(0.5); // Wait for .5 seconds
Lerche 0:d5c405727b8d 12 } // End of While-loop
Lerche 0:d5c405727b8d 13 } // End of Main structure