Created
April 2, 2016 20:53
-
-
Save professorjamesmoriarty/fcc216af7e3d729e5ce0c05300ba2f15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import gpio | |
import time | |
rows = [26, 24, 23, 22] | |
cols = [18, 16, 15, 13] | |
digits = ["1", "2", "3", "4", | |
"5", "6", "7", "8", | |
"9", "10", "11", "12", | |
"13", "14", "15", "16"] | |
for col in range(0, len(cols)): | |
if gpio.input(cols[col]) is False: | |
if colsPusehd[col] is False: | |
# print str(cols[col])+" Pushed" | |
activeRow = findRow(cols[col]) | |
if activeRow > -1: | |
# print(activeRow,col) | |
print digits[activeRow][col] | |
time.sleep(0.1) | |
colsPusehd[col] = True | |
else: | |
if colsPusehd[col] is True: | |
# print str(cols[col])+" Released" | |
time.sleep(0.1) | |
colsPusehd[col] = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment