Ejemplo n.º 1
0
try:
    unichr = unichr
except NameError:
    unichr = chr


lcd = CharLCD(cols=16, rows=2)
# if you have a backlight circuit, initialize like this (substituting the
# appropriate GPIO and BacklightMode for your backlight circuit):
#lcd = CharLCD(cols=16, rows=2, pin_backlight=7, backlight_mode=BacklightMode.active_high)

lcd.backlight = True
input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (0, 15)
lcd.write_string('1')
lcd.cursor_pos = (1, 15)
lcd.write_string('2')
assert lcd.cursor_pos == (0, 0), 'cursor_pos should now be (0, 0)'
Ejemplo n.º 2
0
    pass

try:
    unichr = unichr
except NameError:
    unichr = chr

lcd = CharLCD(cols=16, rows=2)
# if you have a backlight circuit, initialize like this (substituting the
# appropriate GPIO and BacklightMode for your backlight circuit):
#lcd = CharLCD(cols=16, rows=2, pin_backlight=7, backlight_mode=BacklightMode.active_high)

lcd.backlight = True
input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (0, 15)
lcd.write_string('1')
lcd.cursor_pos = (1, 15)
lcd.write_string('2')
assert lcd.cursor_pos == (0, 0), 'cursor_pos should now be (0, 0)'
from RPLCD import CharLCD
from RPLCD import CursorMode
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[33, 31, 29, 23])

lcd.write_string('HELLO JNNCE!')

#lcd.cursor_mode = CursorMode.blink
#lcd.cursor_mode = CursorMode.line
lcd.cursor_mode = CursorMode.hide
Ejemplo n.º 4
0
GPIO.setmode(GPIO.BCM)

lcdCols = 16
lcdRows = 2

pressDelay = .25
newKey = .5

lcd = CharLCD(numbering_mode=GPIO.BCM,
              cols=lcdCols,
              rows=lcdRows,
              pin_rs=2,
              pin_e=3,
              pins_data=[4, 17, 27, 22])
lcd.clear()
lcd.cursor_mode = 'hide'

kp = keypad([26, 16, 20, 21], [6, 13, 19])

words = ('LOL', 'ROFL', 'LMAO', 'BFF', 'B4N', 'DILLIGAS', 'THX', 'TTYL',
         'JOE MAMA', '8', 'OFC', 'CRANK', '2MOR', '2PAC CUBA', 'BRB', 'PLS')

letters = {
    1: (' '),
    2: ('A', 'B', 'C', '2'),
    3: ('D', 'E', 'F', '3'),
    4: ('G', 'H', 'I', '4'),
    5: ('J', 'K', 'L', '5'),
    6: ('M', 'N', 'O', '6'),
    7: ('P', 'R', 'S', '7'),
    8: ('T', 'U', 'V', '8'),
Ejemplo n.º 5
0
## TURN THE CURSOR ON AND OFF

'''
The RPLCD library provides several functions for controlling the cursor.
You can have a block cursor, an underline cursor, or a blinking cursor. Use the following functions to set the cursor:

Blinking block cursor: 'lcd.cursor_mode = "blink"'
Line cursor: 'lcd.cursor_mode = "line"'
Cursor off: 'lcd.cursor_mode = "hide"'
The code below places a blinking cursor after the last character of text:
'''

from RPLCD import CharLCD                   # This is the library which we will be using for LCD Display 
from RPi import GPIO                        # This is the library which we will be using for using the GPIO pins of Raspberry PI

# Initializing the LCD Display
lcd = CharLCD(numbering_mode=GPIO.BOARD, cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[33, 31, 29, 23])
lcd.write_string("Hello world!")

lcd.cursor_mode = "blink"
# lcd.cursor_mode = "line"
# lcd.cursor_mode = "hide"

# Always Clean Up the GPIO after using the code
GPIO.cleanup()
triggered = open("Alarm.txt", "w")



lcd.write_string("welcome!!")

def buttonPressed():
    lcd.clear()
    global password
    global enteredPassword
    global counter
    global escape
    counter = 0
    global incorrectpwd
    global temp
lcd.cursor_mode = CursorMode.line
    lcd.write_string(u'Enter pwd:')

#two dimensional array storing each key
    MATRIX = [[1,2,3,'A'],
             [4,5,6,'B'],
             [7,8,9,'C'],
             ['*',0,'#','D']]


#assign rows and columns to different pins
    ROW = [7,11,12,13]
    COL = [15,16,18,36]

#set columns as outputs
    for j in range(4):