예제 #1
0
                    self.ValueList[1] = cp(smList)
                elif self.ucRxBuffer[1] == '53':
                    self.HexList[2] = cp(self.ucRxBuffer[2:8])
                    smList = []
                    for i in [0, 2, 4]:
                        smList.append(self.HexSinProcess(2, i) / 32768 * 180)
                    self.ValueList[2] = cp(smList)
                elif self.ucRxBuffer[1] == '54':
                    self.HexList[3] = cp(self.ucRxBuffer[2:8])
                    smList = []
                    for i in [0, 2, 4]:
                        smList.append(self.HexSinProcess(3, i))
                    self.ValueList[3] = cp(smList)
                    self.FullValueList.append(cp(self.ValueList))
                self.ucRxCnt = 0

    def allclear(self):
        self.HexList = list([list([''] * 6)] * 4)
        self.ValueList = list([list([0] * 3)] * 4)
        self.FullValueList = []


if __name__ == '__main__':
    Jazz = BTC.pourBluz()
    Jazz.connect()
    Data = BlueZHexUnit()
    while True:
        aLine = Jazz.naivesReceiveHex()
        Data.coupData(aLine)
        print(Data.ValueList)
예제 #2
0
        while True:
            if len(self.FullValueList) > (self.windowLength+self.stepLength):
                del self.FullValueList[0:self.stepLength]
                #print('Pool length is',len(self.FullValueList))
                self.recognize()####################################
                print(self.Feature)


    def lopcoupData(self):#To get the data, which need to be assgined into another thread
        global Bluemodule
        while True:
            #print('Receiving a new data train')
            self.coupData(Bluemodule.naivesReceiveHex())

if __name__=='__main__':
    Data= BHRecog()
    Data.loadModel()
    Data.setWindowLength(400)
    Bluemodule=pourBluz()
    Bluemodule.connect()#Connect to bluetooth module
    Read = threading.Thread(target=Data.lopcoupData, name='ReadTheData')
    Clim = threading.Thread(target=Data.lopClimb, name='ClimbTheData')
    Read.start()
    Clim.start()
    Read.join()
    Clim.join()