Blinking All Leds using BusOut

Dependencies:   mbed

main.cpp

Committer:
dwijaybane
Date:
2015-10-07
Revision:
1:f37612ceda88
Parent:
0:f88d2b00a8e8

File content as of revision 1:f37612ceda88:

#include "mbed.h"   // Basic Library required for onchip peripherals

/* Create Objects */
BusOut myleds(LED1, LED2, LED3, LED4);  // Create a nibble of Digital Outputs named myleds
                                        // So using single nibble one can easily access all listed bits

/* Main Program */
int main() {
    while(1) {
        myleds = 0xF;   // Glow All Leds 
        wait(0.5);      // 500 ms delay
        myleds = 0;     // Turn off all leds
        wait(0.5);      // 500 ms delay
    }
}