From acc875bb3f29df7a314a80a27e30c1f2348be0dd Mon Sep 17 00:00:00 2001 From: gcohen Date: Tue, 6 Jan 2015 00:55:18 -0800 Subject: thread test --- python/examples/futureHouse/futureHouse.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'python/examples') diff --git a/python/examples/futureHouse/futureHouse.py b/python/examples/futureHouse/futureHouse.py index 2978c24..c179347 100644 --- a/python/examples/futureHouse/futureHouse.py +++ b/python/examples/futureHouse/futureHouse.py @@ -113,8 +113,14 @@ def reconnect(message): def disconnect(message): print("DISCONNECTED") -pubnub.subscribe(channel, callback=callback, error=callback, - connect=connect, reconnect=reconnect, disconnect=disconnect) +def pnSubscribe(x): + pubnub.subscribe(channel, callback=callback, error=callback, + connect=connect, reconnect=reconnect, disconnect=disconnect) + +try: + thread.start_new_thread( pnSubscribe, (0,) ) +except: + print "Error: unable to start Subscribe thread" # http://www.raspberrypi.org/forums/viewtopic.php?f=37&t=32826 @@ -199,9 +205,9 @@ def startCycling(): # print str(x) + ": " + str(leds[x]['minPulseLength']) + " " + str(leds[x]['maxPulseLength']) + " " + str(leds[x]['waitFloor']) + " " + str(leds[x]['waitCeiling']) # Change speed of continuous servo on channel O try: - t = thread.start_new_thread( cycleLEDs, (x,) ) + thread.start_new_thread( cycleLEDs, (x,) ) except: - print "Error: unable to start thread" + print "Error: unable to start LED thread" #cycleLEDs(x) -- cgit v1.2.3