Team 1.2 – Code

codeblockWhat you see above is how we went about getting user input from the keypad. We initially set a row high then wait 50ms to ensure the voltage has a chance to ramp up to solid logic levels. We then check to see which column goes high. This tells us which key is pressed by creating a coordinate pair (row, column). We then set the row back low and move on to the next row. This continues until all rows (total of 4) have been set high and then low again.

This could be easily improved by moving the input handler to an interrupt service routine that gets called when changes are detected on the input pins. However, this would also require more time and consideration to pull off without it having adverse effects on the sequential flow of our program.