Task 3.3.2

Fork of Task332 by Nicholas Outram

Committer:
noutram
Date:
Wed Sep 18 11:55:58 2019 +0000
Revision:
2:4eae1698bcf5
Parent:
0:4473259e507f
2019

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:4473259e507f 1 #include "mbed.h"
noutram 0:4473259e507f 2
noutram 2:4eae1698bcf5 3 #ifdef TARGET_NUCLEO_F429ZI
noutram 2:4eae1698bcf5 4 //#define ONBOARD
noutram 2:4eae1698bcf5 5 #endif
noutram 2:4eae1698bcf5 6
noutram 2:4eae1698bcf5 7 #ifdef ONBOARD
noutram 2:4eae1698bcf5 8 BusOut binaryOutput(LED1, LED2, LED3);
noutram 2:4eae1698bcf5 9 #else
noutram 2:4eae1698bcf5 10 //lsb first
noutram 0:4473259e507f 11 BusOut binaryOutput(D5, D6, D7);
noutram 2:4eae1698bcf5 12 #endif
noutram 2:4eae1698bcf5 13
noutram 0:4473259e507f 14 //DigitalIn SW1(D4);
noutram 0:4473259e507f 15
noutram 0:4473259e507f 16 int main() {
noutram 0:4473259e507f 17
noutram 0:4473259e507f 18 unsigned int uiCount = 0;
noutram 0:4473259e507f 19
noutram 0:4473259e507f 20 while(1) {
noutram 0:4473259e507f 21
noutram 0:4473259e507f 22 do {
noutram 0:4473259e507f 23 //Write decimal to the output
noutram 0:4473259e507f 24 binaryOutput = uiCount;
noutram 0:4473259e507f 25
noutram 0:4473259e507f 26 //Increment the count
noutram 0:4473259e507f 27 uiCount = uiCount + 1;
noutram 0:4473259e507f 28 wait(1.0); //Delay for 1s
noutram 0:4473259e507f 29
noutram 0:4473259e507f 30 //Condition to repeat
noutram 0:4473259e507f 31 } while (uiCount < 8);
noutram 0:4473259e507f 32
noutram 0:4473259e507f 33 //Reset the count
noutram 0:4473259e507f 34 uiCount = 0;
noutram 0:4473259e507f 35
noutram 0:4473259e507f 36 } //end while(1)
noutram 0:4473259e507f 37 } //end main