Lab 6 code.

Dependencies:   mbed

Fork of WaG by GroupA

Revision:
3:293ff9cb705d
Parent:
2:b444464ebe67
Child:
4:0ed77d8b3e42
--- a/main.cpp	Tue Feb 20 17:24:19 2018 +0000
+++ b/main.cpp	Wed Feb 21 19:03:43 2018 +0000
@@ -121,6 +121,24 @@
      return result;
 }
 
+int mod_bcd(int num) {
+    int bcd_arr[4];
+    int place = 4;
+    int bcd = 0;
+    int mult = 1;
+    while (num != 0) {
+        int val = num % 10;
+        bcd_arr[place] = val;
+        num = num/10;
+    }
+    for (int i = 1; i < 5; i++) {
+        bcd = bcd + bcd_arr[i]*mult;
+        mult = mult * 10;
+    }
+    return bcd;
+}
+
+
 char to_command(char input, int place) {
     
 }