GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) #Using the GPIO.BOARD setmode servoPin = 11 #Servo Motor control pin(Yellow) IR1 = 31 #Parking Slot 1 Infrared Sensor IR2 = 33 #parking Slot 2 Infrared Sensor exitIR = 37 #Exit Infrared for exiting vehicles #Setting IR1, IR2 and ExitIr as input and ServoPin as Output GPIO.setup(exitIR, GPIO.IN) GPIO.setup(IR1, GPIO.IN) GPIO.setup(IR2, GPIO.IN) GPIO.setup(servoPin, GPIO.OUT) #Listening to the IR sensors for input sensor1 = GPIO.input(IR1) sensor2 = GPIO.input(IR2) exitSensor = GPIO.input(exitIR) display = drivers.Lcd() # Importing LCD Drivers #pwm = GPIO.PWM(servoPin, 50) #PWM initialised at 50Hz frequency availableSlots = 0 #initialising the number of empty slots to 0 #beginning of OpenCv for License Plate recognition cap = cv2.VideoCapture(0) #Starting Video Capture #Entering The endless loop for repetitive function while (True): ret, frame = cap.read() #Read Frames plate = extraction(frame) #take a picture try: text = ocr(plate) #Do Optical Character Recognition text = ''.join(e for e in text if e.isalnum()) #Remove spaces from extracted text except: continue
def __init__(self, ticker=""): self.ticker = ticker self.open_price = self.get_open_price() self.current_price = self.get_current_price() self.display = drivers.Lcd()
if ping(address) else "{} is DOWN".format(host)) # use netcat for services for service, address in services.items(): lcd_print(top="# NetMonitor #", bottom="{} is UP".format(service) if nc( address['ip'], address['port']) else "{} is DOWN".format(service)) except KeyboardInterrupt: end('Signal to stop', 0) except (RuntimeError, IOError): end('I2C bus error', 1) if __name__ == "__main__": # create a display object from the Lcd class display = drivers.Lcd() # customizable dict of unique, pingable hosts hosts = { 'Internet': '8.8.8.8', 'Firewall': '192.168.1.1', 'NAS': '192.168.1.2' } # customizable dict of unique, netcatable services services = { 'Cameras': { 'ip': '192.168.1.2', 'port': '8000' }, 'Plex': { 'ip': '192.168.1.2', 'port': '32400'
#!/usr/bin/env python3 import RPi.GPIO as GPIO #Imports RPi for GPIO Use (Comment/Uncomment to use) import drivers # Imports Custom LCD Display Driver import struct # Imports structure function import time # Imports time function from time import sleep # Imports sleep function from time module disp = drivers.Lcd() # Initializes LCD Display BeepPin=13 ALedPin=6 MORSECODE = { 'A':'01', 'B':'1000', 'C':'1010', 'D':'100', 'E':'0', 'F':'0010', 'G':'110', 'H':'0000', 'I':'00', 'J':'0111', 'K':'101', 'L':'0100', 'M':'11', 'N':'10', 'O':'111', 'P':'0110', 'Q':'1101', 'R':'010', 'S':'000', 'T':'1', 'U':'001', 'V':'0001', 'W':'011', 'X':'1001', 'Y':'1011', 'Z':'1100', '1':'01111', '2':'00111', '3':'00011', '4':'00001', '5':'00000', '6':'10000', '7':'11000', '8':'11100', '9':'11110', '0':'11111', '?':'001100', '/':'10010', ',':'110011', '.':'010101', ';':'101010', '!':'101011', '@':'011010', ':':'111000', } def setup(): GPIO.setmode(GPIO.BCM) GPIO.setup(BeepPin, GPIO.OUT, initial=GPIO.LOW) GPIO.setup(ALedPin,GPIO.OUT,initial=GPIO.LOW) def on(): GPIO.output(BeepPin, 1) GPIO.output(ALedPin, 1)