Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:8582e1359465, 2017-07-13 (annotated)
- Committer:
- noutram
- Date:
- Thu Jul 13 14:51:33 2017 +0000
- Revision:
- 1:8582e1359465
- Parent:
- 0:6858ff5fba1f
updated for mbed-os 5.5
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| noutram | 0:6858ff5fba1f | 1 | #include "mbed.h" |
| noutram | 0:6858ff5fba1f | 2 | |
| noutram | 0:6858ff5fba1f | 3 | BusOut binaryOutput(D5, D6, D7); |
| noutram | 0:6858ff5fba1f | 4 | |
| noutram | 0:6858ff5fba1f | 5 | /* |
| noutram | 0:6858ff5fba1f | 6 | *************************************************** |
| noutram | 0:6858ff5fba1f | 7 | Solution - use the post-decrement operator on iCount |
| noutram | 0:6858ff5fba1f | 8 | *************************************************** |
| noutram | 0:6858ff5fba1f | 9 | */ |
| noutram | 0:6858ff5fba1f | 10 | |
| noutram | 0:6858ff5fba1f | 11 | int main() { |
| noutram | 0:6858ff5fba1f | 12 | |
| noutram | 0:6858ff5fba1f | 13 | int iCount = 7; |
| noutram | 0:6858ff5fba1f | 14 | |
| noutram | 0:6858ff5fba1f | 15 | //Repeat this program forever |
| noutram | 0:6858ff5fba1f | 16 | while(1) { |
| noutram | 0:6858ff5fba1f | 17 | |
| noutram | 0:6858ff5fba1f | 18 | do { |
| noutram | 0:6858ff5fba1f | 19 | binaryOutput = iCount--; //Write decimal to the output and decrement |
| noutram | 0:6858ff5fba1f | 20 | wait(1.00); //Delay for 500ms |
| noutram | 0:6858ff5fba1f | 21 | } while (iCount >= 0); //Condition to repeat |
| noutram | 0:6858ff5fba1f | 22 | |
| noutram | 0:6858ff5fba1f | 23 | //Reset the count |
| noutram | 0:6858ff5fba1f | 24 | iCount = 7; |
| noutram | 0:6858ff5fba1f | 25 | } |
| noutram | 0:6858ff5fba1f | 26 | } |