Kevin Maddox
/
kevin_maddox_Lab1Part2
part 2
Diff: main.cpp
- Revision:
- 0:7febadc94c95
diff -r 000000000000 -r 7febadc94c95 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 03 01:00:31 2014 +0000 @@ -0,0 +1,63 @@ +// Kevin_maddox__Lab1Part2.cpp : Defines the entry point for the console application. + +/*********************************************************************************************** +CREATED BY: KEVIN MADDOX +DATE: 2 DEC 2014 + +SUMMARY: +Our goal is to have 4 LEDs flash 5 times in turn (i.e., LED1 flashes 10 times, followed by LED2, +then followed by LED3, and finally followed by LED4, and it repeats). Design the hardware +connection of your LEDs to mbed. Build your circuit and include all the required +information about your hardware design in your lab report. + +***************************************************************************************************/ + +#include "mbed.h" //calling the mbed.h library + +// creating the digital out objects for each pin out +DigitalOut myLed01(p5); +DigitalOut myLed02(p10); +DigitalOut myLed03(p15); +DigitalOut myLed04(p20); + +int main() +{ + + char i = 0; //init i to zero + + + while (1){ //endless while lopp + + for (i = 0; i < 10; i++) { //start conditional loop led 1 + myLed01 = 1; + wait(0.2); + myLed01 = 0; + wait(0.2); + i++; + } + for (i = 0; i < 10; i++) {//start conditional loop led 2 + myLed02 = 1; + wait(0.2); + myLed02 = 0; + wait(0.2); + i++; + + } + for (i = 0; i < 10; i++) { //start conditional loop led 3 + myLed03 = 1; + wait(0.2); + myLed03 = 0; + wait(0.2); + i++; + } + for (i = 0; i < 10; i++) { //start conditional loop led 4 + myLed04 = 1; + wait(0.2); + myLed04 = 0; + wait(0.2); + i++; + } + + } // closing for endless while + +} // closing for program \ No newline at end of file