ddad

Dependencies:   mbed

Fork of class_7segment_serial by tatiuc embedded

main.cpp

Committer:
mijimy
Date:
2017-06-06
Revision:
2:120a14d6f055
Parent:
1:65d57cc8cb22

File content as of revision 2:120a14d6f055:

#include "mbed.h"
#include "HostIO.h"
#include "SegDisp.h"
Serial pc(USBTX, USBRX);
BusOut Seg1(PC_9,PC_8,PB_8,PC_6,PB_9,PC_5,PA_5,PA_12);// A,B,C,D,E,F,G,DP
BusOut Seg2(PA_8,PB_1,PB_10,PB_15,PB_4,PB_14,PB_5,PB_13);// A,B,C,D,E,F,G,DP
char data1, data2; // variable declarations

int main() 
{ // main program
    SegInit(); // call function to initialise the 7-seg displays
    HostInit(); // call function to initialise the host terminal
        while (1) 
        { // infinite loop
            data2 = GetKeyInput(); // call function to get 1st key press
            Seg1=SegConvert(data2); // call function to convert and output
            data1 = GetKeyInput(); // call function to get 2nd key press
            Seg2=SegConvert(data1); // call function to convert and output
            pc.printf(" "); // display spaces between 2 digit numbers
        }
}