GroupA / Mbed 2 deprecated Lab_6_WaG

Dependencies:   mbed

Fork of WaG by GroupA

Revision:
7:161fe3793ddb
Parent:
5:92cdff7fb885
Child:
8:d8bc78bda829
--- a/display.cpp	Thu Feb 22 02:03:30 2018 +0000
+++ b/display.cpp	Thu Feb 22 02:06:07 2018 +0000
@@ -0,0 +1,38 @@
+/******************************************************************************
+* 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) {
+    
+}
\ No newline at end of file