Rob Toulson / Mbed 2 deprecated PE_06-05_ModularCodeExample

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* Program Example 6.5: main.cpp file for modular 7-seg keyboard controller
00002 
00003 This example program includes example code PE6.06, PE6.07, PE6.08, PE6.09
00004                                                                            */
00005 #include "mbed.h"
00006 #include "HostIO.h"
00007 #include "SegDisplay.h"
00008 char data1, data2;                    // variable declarations
00009 
00010 int main() {                          // main program
00011   SegInit();                          // call init function 
00012   HostInit();                         // call init function
00013   while (1) {                         // infinite loop
00014     data2 = GetKeyInput();            // call to get 1st key press
00015     Seg2  = SegConvert(data2);        // call to convert and output
00016     data1 = GetKeyInput();            // call to get 2nd key press
00017     Seg1  = SegConvert(data1);        // call to convert and output
00018     pc.printf("  ");                  // display spaces on host
00019   }
00020 } 
00021