Пример #1
0
def digit():
    kp = RPi_GPIO.keypad()
    digitPressed = None
    while digitPressed == None:
        digitPressed = kp.getKey()
    led_keypress()
    return digitPressed
Пример #2
0
 def __init__(self):
   self.kb = gpio.keypad(columnCount = 3)
   self.kb.COLUMN = self.COLUMNS
   self.kb.ROW = self.ROWS
   
   gpio.GPIO.setup(self.GREEN_LED,gpio.GPIO.OUT)
   gpio.GPIO.output(self.GREEN_LED,gpio.GPIO.LOW)
   gpio.GPIO.setup(self.RED_LED,gpio.GPIO.OUT)
   gpio.GPIO.output(self.RED_LED,gpio.GPIO.LOW)
   gpio.GPIO.setup(self.DOOR_LOCK,gpio.GPIO.OUT,gpio.GPIO.PUD_DOWN)
   gpio.GPIO.output(self.DOOR_LOCK,gpio.GPIO.LOW)
Пример #3
0
def activateAlarm():
	kp = RPi_GPIO.keypad(columnCount = 3)
	print "Please enter a 3 digit code: "
	code = ""
	digit = ""
	
	for i in xrange(0,3):
		digit = getDigit()
		print digit
		time.sleep(0.2)
		code += str(digit)
	if(str(code) == str(codeToActivate)):
		return True
	else:
		return False
Пример #4
0
def activateAlarm():
	kp = RPi_GPIO.keypad(columnCount = 3)
	print "Please enter your 3 digit security code:"
	code = ""
	digit = ""
	
	for i in xrange(0,3):
		digit = getDigit()
		print digit
		time.sleep(0.2)
		code += str(digit)
	if(str(code) == str(codeToActivate)):
		return True
	else:
		return False
Пример #5
0
from PIL import Image

DC = 23
RST = 24
SPI_PORT = 0
SPI_DEVICE = 0

red = LED(4)
orange = LED(5)
green = LED(6)
blue = LED(7)
button1 = Button(2)
button2 = Button(3)
wait = 0.5

kp = RPi_GPIO.keypad(columnCount=4)
disp = LCD.PCD8544(DC,
                   RST,
                   spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=4000000))

disp.begin(contrast=30)


def digit():
    r = None
    while r == None:
        r = kp.getKey()
    return r


def clearLCD():
Пример #6
0
 def __init__(self):
     self.kp = RPi_GPIO.keypad(columnCount = 3)
Пример #7
0
camera = PiCamera()

DC = 23
RST = 24
SPI_PORT = 0
SPI_DEVICE = 0

red = LED(4)
orange = LED(5)
green = LED(6)
blue = LED(7)
button1 = Button(2)
button2 = Button(3)
wait = 0.5

kp = RPi_GPIO.keypad(columnCount = 4)
disp = LCD.PCD8544(DC, RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=4000000))
image = Image.new('1', (LCD.LCDWIDTH, LCD.LCDHEIGHT))
draw = ImageDraw.Draw(image)
font = ImageFont.load_default()
disp.begin(contrast=50)
pygame.init()
screen = pygame.display.set_mode((475,475),0,32)
black = (0,0,0)

def cameratest():
	camera.resolution = (475, 475)
	camera.start_preview()
	while True:
		if button1.is_pressed:
			camera.capture('/home/pi/pokedex/CameraOut/pokemon.png')
Пример #8
0
from matrix_keypad import RPi_GPIO
import time
import RPi.GPIO as GPIO

DOORPIN = 2

kp = RPi_GPIO.keypad()

def unlockDoor():
    print('unlocking door...')
    GPIO.output(DOORPIN,True)
    time.sleep(3)
    print('locking door...')
    GPIO.output(DOORPIN,False)

def getDigit():
    digitPressed = None
    while digitPressed == None:
        digitPressed = kp.getKey()
    return digitPressed

password = "******"
digits = ""

GPIO.setmode(GPIO.BCM)
GPIO.setup(DOORPIN,GPIO.OUT)

while(1):
    digitPressed = getDigit()
    if(digitPressed == '*'):
        digits = ""
Пример #9
0
from matrix_keypad import RPi_GPIO as keypad_GPIO
from pygame.mixer import Sound, get_init, pre_init


class Status(Enum):
    OFFHOOK = 1
    DIALING = 2
    CONNECTED = 3
    ONHOOK = 4


GPIO.setmode(GPIO.BCM)
GPIO.setup(14, GPIO.OUT)
GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

kp = keypad_GPIO.keypad()
pre_init(44100, -16, 1, 1024)
pygame.init()
row1_tone = Note(697)
row2_tone = Note(770)
row3_tone = Note(852)
row4_tone = Note(941)
col1_tone = Note(1209)
col2_tone = Note(1336)
col3_tone = Note(1477)
dial_tone1 = Note(350)
dial_tone2 = Note(440)

pygame.mixer.init()
audioChannel = pygame.mixer.Channel(0)
audioChannel.set_volume(1.0)
Пример #10
0
from menu import Menu
import RPi.GPIO as GPIO
from matrix_keypad import RPi_GPIO as keypad_GPIO
from pygame.mixer import Sound, get_init, pre_init

class Status(Enum):
	OFFHOOK = 1
	DIALING = 2
	CONNECTED = 3
	ONHOOK = 4

GPIO.setmode(GPIO.BCM)
GPIO.setup(14, GPIO.OUT)
GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
				
kp = keypad_GPIO.keypad()
pre_init(44100, -16, 1, 1024)
pygame.init()
row1_tone = Note(697)
row2_tone = Note(770)
row3_tone = Note(852)
row4_tone = Note(941)
col1_tone = Note(1209)
col2_tone = Note(1336)
col3_tone = Note(1477)
dial_tone1 = Note(350)
dial_tone2 = Note(440)

pygame.mixer.init()
audioChannel = pygame.mixer.Channel(0)
audioChannel.set_volume(1.0)