Improved version of my binary counter. Uses a while loop for greater flexibility (relative to original for loop version).
Revision 110:e80444a6fe3a, committed 2021-10-05
- Comitter:
- CSTritt
- Date:
- Tue Oct 05 13:18:23 2021 +0000
- Parent:
- 109:86a37f0a397f
- Commit message:
- Cleaned up comments.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 86a37f0a397f -r e80444a6fe3a main.cpp --- a/main.cpp Tue Oct 05 05:00:06 2021 +0000 +++ b/main.cpp Tue Oct 05 13:18:23 2021 +0000 @@ -1,5 +1,5 @@ /* - Project: Binary Counter Improved (while loop) Version + Project: 21_BC_Improved_v5 (Improved Binary Counter (while loop) Version) File: main.cpp Displays 8-bit binary count on bar graph display. This version uses a while @@ -11,12 +11,12 @@ ambiguous name error. Written by: Dr. C. S. Tritt - Created: 9/27/21 (v. 1.0) + Created: 10/5/21 (v. 1.1) */ #include "mbed.h" DigitalIn uB(USER_BUTTON); // Button is active low (up = 1, down = 0). -const int bits = 4; // Number of bits to use. +const int bits = 8; // Number of bits to use. const int c_max = pow(2, bits) - 1; // Maximum count. pow is type double. const int sleepTime = 100; // Sleep time in milliseconds. int myCount = 0; // Count to be displayed. Loop counter.