diff options
| author | gcohen | 2015-01-06 00:37:00 -0800 | 
|---|---|---|
| committer | gcohen | 2015-01-06 00:37:00 -0800 | 
| commit | b0e68515b4c08a76b331ad37231cd8dd28b9ea0e (patch) | |
| tree | 6a897c688baed3a44f64b4b213686d972de1b010 /python/examples/futureHouse | |
| parent | 230d8f2f1f13a44ab7eb9a1724e26eacd9e967d0 (diff) | |
| download | pubnub-python-b0e68515b4c08a76b331ad37231cd8dd28b9ea0e.tar.bz2 | |
thread test
Diffstat (limited to 'python/examples/futureHouse')
| -rw-r--r-- | python/examples/futureHouse/futureHouse.py | 21 | 
1 files changed, 11 insertions, 10 deletions
| diff --git a/python/examples/futureHouse/futureHouse.py b/python/examples/futureHouse/futureHouse.py index 92ff974..395b035 100644 --- a/python/examples/futureHouse/futureHouse.py +++ b/python/examples/futureHouse/futureHouse.py @@ -103,6 +103,7 @@ def error(message):  def connect(message):      print("CONNECTED") +    startCycling()  def reconnect(message): @@ -191,16 +192,16 @@ def cycleLEDs(x):      pwm.setPWM(x, 0, leds[x]['maxPulseLength'])      time.sleep(random.uniform(leds[x]['waitCeiling'], leds[x]['waitFloor'])) +def startCycling(): +    while (True): -while (True): +        for x in range(0,7) : +            # 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: +                thread.start_new_thread( cycleLEDs, (x,) ) +            except: +                print "Error: unable to start thread" -    for x in range(0,7) : -        # 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: -            thread.start_new_thread( cycleLEDs, (x,) ) -        except: -            print "Error: unable to start thread" - -        #cycleLEDs(x) +            #cycleLEDs(x) | 
