GroupA / Mbed 2 deprecated Lab_6_WaG

Dependencies:   mbed

Fork of WaG by GroupA

display.cpp

Committer:
phn10
Date:
2018-02-22
Revision:
7:161fe3793ddb
Parent:
5:92cdff7fb885
Child:
8:d8bc78bda829

File content as of revision 7:161fe3793ddb:

/******************************************************************************
* EECS 397
*
* Assignment Name: Lab 4: display_test2
* 
* Authors: Sam Morrison and Phong Nguyen 
* File name: display.cpp
* Purpose: Contain function definitions
* 
* Created: 02/21/2018
* Last Modified: 02/21/2018
*
******************************************************************************/
void mod_bcd(int num) {
    int size = 4;
    int dec_arr[size];
    int place = 0;
    while (num != 0) { //converts decimal input to decimal array using %mod
        int val = num % 10;
        dec_arr[place] = val;
        num = num/10;
        place++;
    }
    for (int i = 0; i < size; i++) { //converts decimal array to binary array
        bcd[i] = convert(dec_arr[i]);
    }
}

int convert(int dec) {//convert decimal to binary
    if (dec == 0) //function complete
        return 0; 
    else //recursive call until converted
        return (dec % 2 + 10 * convert(dec / 2)); 
}

char to_command(char input, int place) {
    
}