diff options
| author | gcohen | 2015-01-06 00:55:18 -0800 | 
|---|---|---|
| committer | gcohen | 2015-01-06 00:55:18 -0800 | 
| commit | acc875bb3f29df7a314a80a27e30c1f2348be0dd (patch) | |
| tree | 3afa7701871afd825004d299ab3ed4f81d1a8135 /python/examples | |
| parent | 48304fc70fde8f84c0c0347cee70bdcb752f0927 (diff) | |
| download | pubnub-python-acc875bb3f29df7a314a80a27e30c1f2348be0dd.tar.bz2 | |
thread test
Diffstat (limited to 'python/examples')
| -rw-r--r-- | python/examples/futureHouse/futureHouse.py | 14 | 
1 files changed, 10 insertions, 4 deletions
| 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) | 
