def start_serial(self):
     serial = serialReceiver(self.serialEnabled, True)
     serial.alarmSettingsSample.connect(self.updateAlarms)
     serial.soundAlarm.connect(self.soundAlarm)
     serial.afterInspSample.connect(self.updateSideBarValues)
     serial.afterExpSample.connect(self.updateSideBarValues)
     serial.VCSettingsSample.connect(self.updateVCSetValues)
     serial.PCSettingsSample.connect(self.updatePCSetValues)
     serial.newSensorSample.connect(self.PlotsWidget.updateGraphs)
     self.thread = serial
     serial.start()
示例#2
0
# Der oprettes henvisninger til klasser så de kan bruges som argumenter til
# andre metoder
clients = server.clients()
cv = threading.Event()


# En tråd til at sende seriel data til klienterne oprettes
sender = server.serialSendToClients(cv, clients, "Consumer",)
sender.setDaemon(True)
sender.start()


# En tråd til at modtage seriel data fra bilen oprettes
serial = server.serial(cv, ser, sender)
serial.setDaemon(True)
serial.start()


print "Server started (Port: %d)," %PORT


while True:
    # Der oprettes en tråd for hver klient der tilslutter
    conn, addr = s.accept()
    clients.addClient(conn, addr)
    th = server.server(args=(conn, addr, clients))
    th.setDaemon(True)
    th.start()

示例#3
0
            if url == "UP":
                rr.forward()
            elif url == "DOWN":
                rr.reverse()
            elif url == "LEFT":
                rr.right()
            elif url == "RIGHT":  
                rr.left()
            elif url == "STOP":
                rr.stop()
            elif url == "DIST":
                dist = getDistance(TRIG, ECHO)
                print("distance: %s" % str(dist))
            else:
                print("Message: %s" % msg)

server = threading.Thread(target=ServerThread, args=[])
server.start()

def SerialGetThread():
    s = SerialData()
    while(True):
        in_str = s.next()
        print(in_str)

serial = threading.Thread(target=SerialGetThread, args=[])
serial.start()

# def CollisionDetectionThread():