Upload shropshire_195.py
Browse files- shropshire_195.py +38 -0
shropshire_195.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""shropShire.195
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1pYRVRlNzu_4oFQPEhcny93poDdSdF_Ho
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import RPi.GPI as GPIO
|
| 11 |
+
from time import sleep
|
| 12 |
+
GPIO.setmode(GPIO.BOARD)
|
| 13 |
+
rows=[11,13,15,29]
|
| 14 |
+
columns=[31,33,35,37]
|
| 15 |
+
keyPad=[[1,2,3,'A'],[4,5,6,'B'],[7,7,9,'C'],['*',0,'#','D']]
|
| 16 |
+
GPIO.setup(rows[0],GPIO.OUT)
|
| 17 |
+
GPIO.setup(rows[1],GPIO.OUT)
|
| 18 |
+
GPIO.setup(rows[2],GPIO.OUT)
|
| 19 |
+
GPIO.setup(rows[3],GPIO.OUT)
|
| 20 |
+
|
| 21 |
+
GPIO.setup(columns[0],GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
|
| 22 |
+
GPIO.setup(columns[1],GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
|
| 23 |
+
GPIO.setup(columns[2],GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
|
| 24 |
+
GPIO.setup(columns[3],GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
|
| 25 |
+
try:
|
| 26 |
+
myRow=int(input('Which Row to Read'))
|
| 27 |
+
myColumn=int(input('Which Column to Read'))
|
| 28 |
+
while True:
|
| 29 |
+
GPIO.output(row[myRow],GPIO.HIGH)
|
| 30 |
+
butVal=GPIO.input(columns[myColumn])
|
| 31 |
+
GPIO.output(row[myRow],GPIO.LOW)
|
| 32 |
+
if butVal==1:
|
| 33 |
+
print(keyPad[myRow][myColumn])
|
| 34 |
+
sleep(.2)
|
| 35 |
+
except KeyboardInterrupt:
|
| 36 |
+
sleep.(.1)
|
| 37 |
+
GPIO.cleanup()
|
| 38 |
+
print('GPIO Ready To Perform')
|