I'm working on a project which uses an 3x4 membrane pad and a 16x2 Adafruit I2C LCD display.
the goal is to display the pressed numbers on the LCD display but i can't get it working and don't know how to proceed.
I get them working fine in 2 seperate python scripts but when i try to merge them it's going wrong.
For the LCD display i'm using the Adafruit libraries and i'm supspecting them as the cause of it.
I'm just a beginner so this is just a gamble and don't know how to proceed from this point.
Can some one help me out here? how do i get these 2 python scripts merged to 1 working script?
I already googled my ass off and searched in this forum but i can't find anything suitable.
used materials:
3x4 membrane pad
16x2 LCD i2C Adafruit
Raspberry Pi B+
see seperate scripts below:
Code: Select all
# 3x4 Matrix membrane keypad
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
MATRIX= [[1,2,3],
[4,5,6],
[7,8,9],
['*',0,'#']
]
ROW=[7,11,13,15]
COL=[12,16,18]
for j in range(3):
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(3):
GPIO.output(COL[j],0)
for i in range(4):
if GPIO.input(ROW[i]) == 0:
print MATRIX [i][j]
time.sleep(0.2)
while (GPIO.input(ROW[i])==0):
pass
GPIO.output(COL[j],1)
except KeyboardInterrupt:
GPIO.cleanup()
Code: Select all
#LCD I2C test
Import Adafruit_CharLCD as LCD
import time
lcd=LCD.Adafruit_CharLCDplate()
lcd.clear()
time.sleep(2)
lcd.message(' Hello ')
time.sleep(5)
lcd.clear()
thanks,
regards Bart
