Пример #1
0
	# start the thing  (hops to black if we haven't set the payload)
	kinetsender.start()

	h = []
	s = []
	l = []

	# HUE RANGE 
	# H = 220 to 340
	
	# AND FOR NOW, 
	# S = 1
	# L = 0.5		
	
	hstep = 120.0 / 50.0  # hues are 0 to 360, this does 0 to 225, stepping through for each light

	for k in range (0,2):
		for i in range (0,50):
			h.append(i*hstep + 220)
			s.append(1)
			l.append(.5)

	strandPair.setHSLArray(h,s,l)

	raw_input("Press Enter to continue...")

	strandPair.setHSL(0,0,0)	
	time.sleep(0.250)
	kinetsender.stop = True
	kinetsender.complete.wait()			
Пример #2
0

if __name__ == "__main__":
    # Network configuration : for production system
    # IP Address. . . . . . . . . . . . : 131.179.141.34
    # Subnet Mask . . . . . . . . . . . : 255.255.255.128
    # Default Gateway . . . . . . . . . : 131.179.141.1

    # Set up a single icolorflex sender
    # and broadcast it to all strands
    #
    if config.light:
        strandPair = IColorFlex(2)
        kinetsender = KinetSender(config.SELF_IP, config.PDS_IP, 2, 150, None, False)
        kinetsender.addPayloadObject(strandPair)
        strandPair.setHSL(0, 0, 0)  # Set initial payload to black
        kinetsender.start()

    print ("generating values for lighting from GDP")

    application.listen(8082)
    # tornado.ioloop.PeriodicCallback(res, 1)

    respondToKey(54)

    # cannot seem to start these both simultaneously... they're mutually exclusive.
    # can't find a simple thread manager pattern that lets me at least exchange a key stroke...
    thread.start_new_thread(mainLoop, ("loop thread", g))
    tornado.ioloop.IOLoop.instance().start()

    # mainLoop()