Displays 4 bit binary count on bar graph display. Demonstrates BusOut usage.
Fork of Nightlight3 by
main.cpp
- Committer:
- CSTritt
- Date:
- 2017-09-13
- Revision:
- 6:0c1ab2c11252
- Parent:
- 5:f723b267eae3
- Child:
- 7:52ed5fbb1208
File content as of revision 6:0c1ab2c11252:
/* Project: BinaryCount File: main.cpp Displays 4 bit binary count on bar graph display. Written by: Dr. C. S. Tritt Created: 9/13/17 (v. 1.0) */ #include "mbed.h" BusOut barGraph(D5, D4, D3, D2); // Create barGraph BusOut object. DigitalOut pinD7(D7); // Needed to force this pin off. int main() { printf("Binary count example\n"); // ID software. pinD7 = 0; // Force pin D7 off. This shouldn't be necessary. barGraph = 0; // Light top bar. while(true) { barGraph = barGraph + 1; // Add one to count. wait(1.0); if (barGraph == 15) { barGraph = 0; } } }