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
- Committer:
- CSTritt
- Date:
- 2021-09-21
- Revision:
- 108:eee3167b25b4
- Parent:
- 107:61b9c99a4e27
- Child:
- 109:b061f9830736
File content as of revision 108:eee3167b25b4:
/* Project: BinaryCount File: main.cpp Displays 8 bit binary count on bar graph display. Written by: Dr. C. S. Tritt Created: 9/20/21 (v. 1.2) */ #include "mbed.h" BusOut barGraph(D2, D3, D4, D5, D6, D7, D8, D9); // Create BusOut object. int main() { // Test the wiring. barGraph = 0; // All bars off (base 10). ThisThread::sleep_for(400); // For 0.4 seconds. barGraph = 0b01010101; // Odd bars on (binary). ThisThread::sleep_for(400); // Test even bars for 0.4 seconds. barGraph = 0b10101010; // Even bars on (binary). ThisThread::sleep_for(400); // Test even bars for 0.4 seconds. barGraph = 0xFF; // All bars on. Hex. ThisThread::sleep_for(400); // For 0.4 seconds. // Enter main loop. while(true) { for (int i = 0; i < 256; i++) { // Add one to count. barGraph = i; // Copy the count to the bargraph. ThisThread::sleep_for(100); // Display the value for 0.1 seconds. } } }