示例#1
0
 def __init__(self, car_name):
     self.car = Car(car_name)
     self.car.steering.turning_max = 50
     self.color = self.car.color_getter
     self.flag = True
     self.buzzer = Buzzer.Buzz()
     self.led = LED.Led()
     self.song = Buzzer_Elise.Elise()
示例#2
0
import time
import string
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522 as rc
#from tem import testHDC1080 as hdc
import LED as l
import stu_management1
#from detectpeople import detectPeople as dt

go_out = rc.SimpleMFRC522(bus=0, device=1)
come_back = rc.SimpleMFRC522(bus=1, device=2)
#tem_hum = hdc.TempHum()
led = l.Led()
#detect_people = dt.DetectPeople()

while True:
    read_go_out = go_out.read()
    read_come_back = come_back.read()
    #read_detect = detect_people.detect()
    if read_go_out[0]:
        if read_go_out[1] == 1:
            led.red()
        else:
            led.green()
            #print(read_go_out[1].strip())
            print(f'uid:{read_go_out[0]}\nnum:{read_go_out[1]}\ngo out',
                  time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
            #print(f'temperature:{read_temhum[0]}\nhumidity:{read_temhum[1]}%')
            stu_management1.add_rfid(1, read_go_out[1].strip(), read_go_out[0])
    if read_come_back[0]:
        if read_come_back[1] == 1:
示例#3
0
import stu_management1


#设置IP和端口
host = '192.168.43.122'
port = 5000
print("服务端开启")
#套接字接口
mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#立即释放端口
mySocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#bind绑定该端口
mySocket.bind((host, port))
mySocket.listen(1)
tem = testHDC1080.TempHum()
led = LED.Led()




while True:
    #接收客户端连接
    print("等待连接....")
    client, address = mySocket.accept()
    print("新连接")
    print("IP is %s" % address[0])
    print("port is %d\n" % address[1]) 
    while True:
        try:
            #read.Door()
            #读取消息
示例#4
0
import LED as led
from time import sleep
# setup IO pins
import RPi.GPIO as GPIO
import time

fastBlinkDelay = 0.1
slowBlinkDelay = 0.5

# setup LEDs
statusLed = led.Led(5, True)  # status LED    w/29
goLed = led.Led(6, False)  # Go
noGoLed1 = led.Led(13, False)  # NoGo 1
noGoLed2 = led.Led(19, False)  # NoGo 2
noGoLed3 = led.Led(26, False)  # NoGo 3

noGoLeds = [noGoLed1, noGoLed2, noGoLed3]
allLeds = [statusLed, goLed, noGoLed1, noGoLed2, noGoLed3]


def fastBlink(led, numOfBlinks):
    for x in range(numOfBlinks):
        led.turnOn()
        time.sleep(fastBlinkDelay)
        led.turnOff()
        time.sleep(fastBlinkDelay)


def slowBlink(led, numOfBlinks):
    for x in range(numOfBlinks):
        led.turnOn()