Nicholas Outram
/
Task332
Task 3.3.2
main.cpp@0:4473259e507f, 2015-09-24 (annotated)
- Committer:
- noutram
- Date:
- Thu Sep 24 12:26:04 2015 +0000
- Revision:
- 0:4473259e507f
Initial version 24-09-2015
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 0:4473259e507f | 1 | #include "mbed.h" |
noutram | 0:4473259e507f | 2 | |
noutram | 0:4473259e507f | 3 | BusOut binaryOutput(D5, D6, D7); |
noutram | 0:4473259e507f | 4 | //DigitalIn SW1(D4); |
noutram | 0:4473259e507f | 5 | |
noutram | 0:4473259e507f | 6 | int main() { |
noutram | 0:4473259e507f | 7 | |
noutram | 0:4473259e507f | 8 | unsigned int uiCount = 0; |
noutram | 0:4473259e507f | 9 | |
noutram | 0:4473259e507f | 10 | while(1) { |
noutram | 0:4473259e507f | 11 | |
noutram | 0:4473259e507f | 12 | do { |
noutram | 0:4473259e507f | 13 | //Write decimal to the output |
noutram | 0:4473259e507f | 14 | binaryOutput = uiCount; |
noutram | 0:4473259e507f | 15 | |
noutram | 0:4473259e507f | 16 | //Increment the count |
noutram | 0:4473259e507f | 17 | uiCount = uiCount + 1; |
noutram | 0:4473259e507f | 18 | wait(1.0); //Delay for 1s |
noutram | 0:4473259e507f | 19 | |
noutram | 0:4473259e507f | 20 | //Condition to repeat |
noutram | 0:4473259e507f | 21 | } while (uiCount < 8); |
noutram | 0:4473259e507f | 22 | |
noutram | 0:4473259e507f | 23 | //Reset the count |
noutram | 0:4473259e507f | 24 | uiCount = 0; |
noutram | 0:4473259e507f | 25 | |
noutram | 0:4473259e507f | 26 | } //end while(1) |
noutram | 0:4473259e507f | 27 | } //end main |