Task 3.3.2 Solution

Fork of Task332Solution by Nicholas Outram

main.cpp

Committer:
noutram
Date:
2019-09-18
Revision:
2:650196238978
Parent:
0:7b9a83230461

File content as of revision 2:650196238978:

#include "mbed.h"

#ifdef TARGET_NUCLEO_F429ZI
//#define ONBOARD
#endif

#ifdef ONBOARD
BusOut binaryOutput(LED1, LED2, LED3);
#else
//lsb first
BusOut binaryOutput(D5, D6, D7);
#endif

int main() {

    int iCount = 7;

    while(1) {
        
        do {
            //Write decimal to the output
            binaryOutput = iCount;
            
            //Increment the count
            iCount = iCount - 1;  
            wait(1.0);              //Delay for 1s

        //Condition to repeat
        } while (iCount >= 0);    
                            
        //Reset the count
        iCount = 7;
        
    } //end while(1)
} //end main