Ejemplo n.º 1
0
def main():
    spi = SPI(sck=Pin(18), mosi=Pin(23), miso=Pin(19))
    lcd = LCD.LCD(spi, cs=Pin(26), rs=Pin(17), rst=Pin(16), led=Pin(13))
    lcd.lcd_clear(lcd.color_white)
    lcd.set_back_color(lcd.color_blue)
    lcd.set_point_color(lcd.color_red)
    lcd.lcd_show_string(0, 0, 12, 'Hello MicroPython', 1)
Ejemplo n.º 2
0
def getPlateInfo():
    try:
        plate = request.form['plate']
        data = firestore.getInfoByPlate(plate)
        Servo.servo()
        LCD.LCD(plate)
        response = app.response_class(status=200,
                                      response=json.dumps(data),
                                      mimetype='application/json')
        return response
    except Exception as identifier:
        LCD.LCD('Ban chua dang ki')
        print("get errors")
        print(identifier)
        return app.response_class(status=500,
                                  response=json.dumps(
                                      {'message': 'Internal server error'}),
                                  mimetype='application/json')
Ejemplo n.º 3
0
def main():
    lcd = LCD()
    airmon = Airmon("wlan0")
    airmon.start()
    main_airdump = Airodump(lcd)
    main_airdump.start()
    for x in xrange(100):
        print str(x)
        time.sleep(1)
    main_airdump.stop()
    print "done"
Ejemplo n.º 4
0
    def __new__(self):

        if self._instance is None:
            self._instance = super(Main, self).__new__(self)
            self._motor_control = MotorControl()
            # print(self._motor_control)
            self._lcd = LCD()
            self._lcd.start()
            self._temperature = temperature()
            self._light = light()
            self._distance = Distance()
            self._compass = compass(declination=(1, 19))

        return self._instance
Ejemplo n.º 5
0
from machine import ADC, SPI, PWM, Pin, freq
from FlagArcade import *
import LCD

# 螢幕初始設定
spi = SPI(1, baudrate=40000000)
screen = LCD.LCD(spi, 15, 5, 0)
screen.init()
screen.clearLCD()

# 按鈕腳位設定
adc = ADC(0)

# 蜂鳴器腳位與強度設定
buzzer = PWM(Pin(4))
amp = 512


# 設計遊戲音效
def ding():
    buzzer.freq(988)
    buzzer.duty(amp)
    time.sleep(.05)
    buzzer.duty(0)


def toot():
    buzzer.freq(494)
    buzzer.duty(amp)
    time.sleep(.01)
    buzzer.duty(0)
Ejemplo n.º 6
0
import LCD
from machine import freq, SPI, Pin, PWM, ADC, Timer
import time
from flaglib import *

freq(160000000)

spi = SPI(1, baudrate=40000000, polarity=0, phase=0)
lcd = LCD.LCD(spi, 15, 5, 0)
lcd.init()
lcd.setRotation(4)
lcd.clearLCD()

adc = ADC(0)
button = Pin(4, Pin.IN, Pin.PULL_UP)
buzzer = PWM(Pin(12))

left_pixels_1 = (b"   1   1         11 "
                 b"  11   11        11 "
                 b" 111111111        1 "
                 b" 11 111 11       11 "
                 b"111 111 11111 1 11  "
                 b" 1111 1111 11 1 111 "
                 b"1111   111111111111 "
                 b"  1111111 111111111 "
                 b"         1111111111 "
                 b"      111111111111  "
                 b"      11       11   ")
left_pixels_2 = (b"  1     1       11  "
                 b"  11   11       11  "
                 b" 111111111       1  "
GPIO.setup(25, GPIO.IN)  #in
GPIO.setup(22, GPIO.IN)  #servo
track = 0
status = False
while True:
    sensorIn = GPIO.input(25)
    sensorTracking = GPIO.input(22)

    if sensorIn == 0 and track == 0:
        print("F**k")
        plate = detect.get_plate()
        if plate != "":
            status = firestore.getInfoByPlate(plate)
            if status != False:
                moneyBack = status["money"] - 5000
                firestore.updateDB(plate, moneyBack, status["status"])
                sleep(0.1)
                Servo.openServo()
                LCD.LCD(plate)
                track = track + 1
            else:
                LCD.LCD("Bien so ko hop le")
        else:
            LCD.LCD("Bien so ko hop le")
    if sensorTracking == 0 and track == 1:
        track = 0
    if sensorIn == 1 and sensorTracking == 1 and track == 0:
        Servo.closeServo()
        print("This is 0")
        sleep(0.1)
Ejemplo n.º 8
0
 def Adafruit_CharLCDBackpack(address): return LCD()
 def __init__(self): pass
Ejemplo n.º 9
0
Archivo: cam.py Proyecto: h2n0/EngWork
from LCD import *
import RPi.GPIO as GPIO
import time as t
import subprocess as sub

version = "0.3A"
lcd = LCD()
h = GPIO.HIGH
l = GPIO.LOW
delay = 0.4
encoderA = 16
encoderB = 21
encoderButton = 20
encoderVal = 0
lastencoded = 0
stage = 1
setup = True

motorL = 19
motorR = 26

FPH = 0
H = 0
totalFrames = 0
currentFrame = 0

#Setup
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(encoderA, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(encoderB, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Ejemplo n.º 10
0
#!/usr/bin/env python3

import LCD

x = LCD.LCD()
x.set_lcd_contrast(9)
Ejemplo n.º 11
0
total_images2 = 101
file2 = "filtered_image_data.csv"

model2 = AtopicEczemaModel(file2, total_images2)
model2.setup()
model2.train_new_model()
print(model2.runTest(0.2))

camera = PiCamera()
camera.resolution = (1024, 768)

GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

lcd = LCD.LCD()

counter = 0

lcd.clearScreen()
lcd.printOut("Hello")

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "../token.json"

mydb = mysql.connector.connect(
    host="34.70.40.173",
    user="******",
    passwd="password123",
    database="test",
)
from bbio.libraries.SafeProcess import *
import random
from math import atan2, sin
from LCD import *

setPoint = Array('i', [0, 0])

encoder_R = RotaryEncoder(RotaryEncoder.EQEP2b)
encoder_L = RotaryEncoder(RotaryEncoder.EQEP1)
LEFT_PWM = PWM1A
RIGHT_PWM = PWM2A
LEFT_ON = GPIO2_23
LEFT_LOW = GPIO2_22
RIGHT_ON = GPIO2_25
RIGHT_LOW = GPIO2_24
newDisplay = LCD(0x63)

SPI0.begin()
SPI0.setMaxFrequency(0, 50000)
SPI0.setMaxFrequency(1, 50000)
SPI1.begin()
SPI1.setMaxFrequency(0, 50000)
SPI1.setMaxFrequency(1, 50000)

error_h = [0, 0]
i_e = 0
d_e = 0
threshold = 300


def adc_read(cs, ch):
Ejemplo n.º 13
0
 def __init__(self):
     #start LCD object
     self.LCD = LCD.LCD()
     self.tempControl = temp.TempControl()
     self.fans = fans.Fans()
Ejemplo n.º 14
0
 def __init__(self):
     self.lcd = LCD()
     self.rogue_aps = []
Ejemplo n.º 15
0
CHECK_SCHEDULE_COUNT_LCD = 1000


#/**************************************************************************/
#/* Main application procedure.                                            */
#/**************************************************************************/
# Instance of the system time class to handle system time and clock module.
ThisSystemTime = SystemTime.SystemTime()
# Instance of schedule class to store and process timer schedules.
ThisSchedule = Schedule.Schedule()
# Instnace of relays class to store current relay states.
ThisRelays = Relays.Relays()
#Instance of keypad class to read key presses on a GPIO keypad.
ThisKeypad = Keypad.Keypad(GPIO_KEYPAD_PINS)
#Instance of LCD class to write to a GPIO LCD module.
ThisLCD = LCD.LCD(GPIO_LCD_PINS)

#  /*********************************************************/
# /* Configure the console so key presses can be captured. */
#/*********************************************************/
window = False
if TERMINAL:
   curses.initscr()
   curses.noecho()
   window = curses.newwin(80, 25)
   window.nodelay(1)
   window.timeout(0)

# Instance of user interface class to manage user interactions.
ThisUserInterface = UserInterface.UserInterface(window, ThisLCD, ThisSchedule, ThisRelays)
Ejemplo n.º 16
0
import USBModem

greenButton=23
redButton=24
solePin=25
flowPin=18

greenRFIDIndic=5
redRFIDIndic=6
greenButtonIndic=13
redButtonIndic=19


mCode = "pi62244632"

LCD_ = LCD.LCD()
rfidReader = MFRC522.MFRC522()
cam = webCam.webCam()
db=Database.Database()


flow_count=0
flow_totalFlow=0
flow_startTime=0
flow_elapsedTime=0


def pinModeSetup():
    	GPIO.setmode(GPIO.BCM)
	GPIO.setwarnings(False)
    	GPIO.setup(greenButton, GPIO.IN)