Task 3.3.2 Solution

Committer:
noutram
Date:
Thu Jul 13 14:49:52 2017 +0000
Revision:
1:0453bbe1940b
Parent:
0:7b9a83230461
updated for mbed-os 5.5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:7b9a83230461 1 #include "mbed.h"
noutram 0:7b9a83230461 2
noutram 0:7b9a83230461 3 BusOut binaryOutput(D5, D6, D7);
noutram 0:7b9a83230461 4 //DigitalIn SW1(D4);
noutram 0:7b9a83230461 5
noutram 0:7b9a83230461 6 int main() {
noutram 0:7b9a83230461 7
noutram 0:7b9a83230461 8 int iCount = 7;
noutram 0:7b9a83230461 9
noutram 0:7b9a83230461 10 while(1) {
noutram 0:7b9a83230461 11
noutram 0:7b9a83230461 12 do {
noutram 0:7b9a83230461 13 //Write decimal to the output
noutram 0:7b9a83230461 14 binaryOutput = iCount;
noutram 0:7b9a83230461 15
noutram 0:7b9a83230461 16 //Increment the count
noutram 0:7b9a83230461 17 iCount = iCount - 1;
noutram 0:7b9a83230461 18 wait(1.0); //Delay for 1s
noutram 0:7b9a83230461 19
noutram 0:7b9a83230461 20 //Condition to repeat
noutram 0:7b9a83230461 21 } while (iCount >= 0);
noutram 0:7b9a83230461 22
noutram 0:7b9a83230461 23 //Reset the count
noutram 0:7b9a83230461 24 iCount = 7;
noutram 0:7b9a83230461 25
noutram 0:7b9a83230461 26 } //end while(1)
noutram 0:7b9a83230461 27 } //end main