Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of WaG by
Diff: display.cpp
- 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