diff options
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) |
