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.
Fork of BinaryCount by
main.cpp@6:0c1ab2c11252, 2017-09-13 (annotated)
- Committer:
- CSTritt
- Date:
- Wed Sep 13 10:32:11 2017 +0000
- Revision:
- 6:0c1ab2c11252
- Parent:
- 5:f723b267eae3
- Child:
- 7:031078522195
Initial version. Works.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CSTritt | 0:8ed2f4a2a2fe | 1 | /* |
CSTritt | 6:0c1ab2c11252 | 2 | Project: BinaryCount |
CSTritt | 0:8ed2f4a2a2fe | 3 | File: main.cpp |
CSTritt | 0:8ed2f4a2a2fe | 4 | |
CSTritt | 6:0c1ab2c11252 | 5 | Displays 4 bit binary count on bar graph display. |
CSTritt | 0:8ed2f4a2a2fe | 6 | |
CSTritt | 0:8ed2f4a2a2fe | 7 | Written by: Dr. C. S. Tritt |
CSTritt | 6:0c1ab2c11252 | 8 | Created: 9/13/17 (v. 1.0) |
CSTritt | 0:8ed2f4a2a2fe | 9 | */ |
CSTritt | 0:8ed2f4a2a2fe | 10 | #include "mbed.h" |
CSTritt | 0:8ed2f4a2a2fe | 11 | |
CSTritt | 6:0c1ab2c11252 | 12 | BusOut barGraph(D5, D4, D3, D2); // Create barGraph BusOut object. |
CSTritt | 6:0c1ab2c11252 | 13 | DigitalOut pinD7(D7); // Needed to force this pin off. |
CSTritt | 0:8ed2f4a2a2fe | 14 | |
CSTritt | 0:8ed2f4a2a2fe | 15 | int main() { |
CSTritt | 6:0c1ab2c11252 | 16 | |
CSTritt | 6:0c1ab2c11252 | 17 | printf("Binary count example\n"); // ID software. |
CSTritt | 0:8ed2f4a2a2fe | 18 | |
CSTritt | 6:0c1ab2c11252 | 19 | pinD7 = 0; // Force pin D7 off. This shouldn't be necessary. |
CSTritt | 0:8ed2f4a2a2fe | 20 | |
CSTritt | 6:0c1ab2c11252 | 21 | barGraph = 0; // Light top bar. |
CSTritt | 0:8ed2f4a2a2fe | 22 | while(true) { |
CSTritt | 6:0c1ab2c11252 | 23 | barGraph = barGraph + 1; // Add one to count. |
CSTritt | 6:0c1ab2c11252 | 24 | wait(1.0); |
CSTritt | 6:0c1ab2c11252 | 25 | if (barGraph == 15) { |
CSTritt | 6:0c1ab2c11252 | 26 | barGraph = 0; |
CSTritt | 2:5682a72277ed | 27 | } |
CSTritt | 0:8ed2f4a2a2fe | 28 | } |
CSTritt | 4:aa100356f053 | 29 | } |