def killAll(self):
     self._stop = True
     if self.isAlive():
         self._log.info('killAll(): Waiting for thread to finish')
         self._complete.wait()
     self._log.info('killAll(): Thread stopped')
     KinetSender.finish(self._kinetSender)
Beispiel #2
0
if __name__ == '__main__':  
    print '**main**'
    logging.basicConfig(filename="ColorBlast.log", filemode='w', level=logging.DEBUG)
    Z = ColorBlast(NUM_PORTS, NUM_LIGHTS, logging.getLogger('ColorBlast'))
#    K = KinetSender.KinetSender("131.179.143.102", "131.179.143.99", NUM_PORTS,
#            3*NUM_LIGHTS, logging.getLogger('KinetSender'))
    K = KinetSender.KinetSender("127.0.0.1", "131.179.141.50", NUM_PORTS,
            3*NUM_LIGHTS, logging.getLogger('KinetSender'))

    N1=-1
    N2=256
    kintr=0
    while (N1<255):
    	try:
            N1+=1
            N2-=1
            Z.setRGB(N1, N1, N1, None, [0, 1])
            Z.setRGB(N2, N2, N2, None, [2, 3])
            K.setPayload(1, Z.payload[0])  # Port = 0 in ColorBlast.py, equivalent to Port = 1 in KinetSender.py   
            print str(K.getPayload(1))
            time.sleep(2)
        except KeyboardInterrupt, k:
            print 'Interrupted by user.'
            KinetSender.finish(K)
        except Exception, e:
            print 'Program generated some Exception.'
            traceback.print_exc()
            KinetSender.finish(K)
    
    KinetSender.finish(K)