Charles Tritt / Mbed 2 deprecated FlexiBarDemo

Dependencies:   mbed

Fork of BinaryCount by Charles Tritt

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002     Project: FlexiBarDemo
00003     File: main.cpp
00004 
00005     Test harness for flexiBar bar graph display function.
00006 
00007     Written by: Dr. C. S. Tritt
00008     Created: 9/13/17 (v. 1.0)
00009 */
00010 #include "mbed.h"
00011 #include <flexiBar.h>
00012 
00013 // Create 10-bit BusOut object called barGraph.
00014 BusOut barGraph(D11, D10, D9, D8, D7, D6, D5, D4, D3, D2);
00015 
00016 int main() {
00017 
00018     printf("flexiBar Test Harness\n"); // ID software.
00019     
00020     // Start by directly testing the display.
00021     barGraph = 0b1111111111;  // Light all bars.
00022     wait(2.0);
00023     barGraph = 0;  // All bars off.
00024     wait(2.0);
00025     
00026     // Loop through all values in both modes.
00027     while(true) {
00028         bool single = true;
00029         for (int n = 0; n <= 9; n++) {
00030             flexiBar(n, barGraph, single, true);
00031             wait(1.0);
00032         }
00033         single = false;
00034         for (int n = 0; n <= 9; n++) {
00035             flexiBar(n, barGraph, single, true);
00036             wait(1.0);
00037         }
00038         // Test the special case of all bars off. Third argument is ignored.
00039         flexiBar(-1, barGraph, false, true);
00040         wait(2.0);   
00041     }
00042 }