Dushyant Kumar
/
4-bitcounter
Binary Counter
Diff: main.cpp
- Revision:
- 0:2e74c6cefef0
diff -r 000000000000 -r 2e74c6cefef0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 23 19:55:15 2019 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +//#include "BusOut.h" +BusOut myleds(LED1,LED2,LED3,LED4); //defining four leds on board as output bus + +int main() +{ + unsigned char i; // defining i as character variable + while(1) { + for(i=0; i<=15; i++) { // for loop to count from 0 - 15 having 4 - counter + //myleds=i; // assigning the counted value to leds on the board + myleds.write(i); // assigning the counted value to leds on the board using write function + wait(0.5); // delay to hold led for some time in on/off condition + } + } +}