By: Casper, Frank & Jannick
Introduction
For our IoT Project we have decided to work multi threading and a queue, to manage multiple inquiries and inputs for the pi and it’s components.


IOT og maker space på Zealand, Roskilde
Source code:
source
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
MATRIX = [ [1,2,3,'A'],
[4,5,6,'B'],
[7,8,9,'C'],
['*',0,'#','D'] ]
ROW = [5,6,13,19]
COL = [26,16,20,21]
for j in range(4) :
GPIO.setup(COL[j], GPIO.OUT)
GPIO.output(COL[j], 1)
for i in range(4) :
GPIO.setup(ROW[i], GPIO.IN, pull_up_down = GPIO.PUD_UP)
try:
while(True) :
for j in range(4) :
GPIO.output(COL[j],0)
for i in range(4) :
if GPIO.input(ROW[i]) == 0:
print MATRIX[i][j]
while(GPIO.input(ROW[i]) == 0) :
pass
GPIO.output(COL[j],1)
except KeyboardInterrupt :
GPIO.cleanup()
Pastebin: http://pastebin.com/gV9e466L
Fritzing PDF:
Keypad-4x4_RPi_wiring_bb
Get it to work:
1) Get access to RPI
2) Write: sudo nano
3) Paste the code from above into the text editor
4) Press CTRL+X
5) Press Y
6) Give the file a name Name.py
7) Press Enter
8) Write: python Name.py
9) Press Enter
10) Program is running.
Post by: Nicki, Rasmus & Thor