diff options
| author | gcohen | 2015-01-06 00:18:22 -0800 |
|---|---|---|
| committer | gcohen | 2015-01-06 00:18:22 -0800 |
| commit | 070a233e22e932ee2f444053ae75b413d67e8ae9 (patch) | |
| tree | 5780ba61ec2b3be68a4a27303b82228d38fd67a8 /python/examples/futureHouse | |
| parent | d349c8121d51288f99cbcd9e665e3768c7a2d482 (diff) | |
| download | pubnub-python-070a233e22e932ee2f444053ae75b413d67e8ae9.tar.bz2 | |
running waits on sep threads
Diffstat (limited to 'python/examples/futureHouse')
| -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 f7a368e..d2204cb 100644 --- a/python/examples/futureHouse/futureHouse.py +++ b/python/examples/futureHouse/futureHouse.py @@ -182,11 +182,17 @@ def moveDoor(direction): # Initialise the PWM device using the default address pwm = PWM(0x40, debug=False) pwm.setPWMFreq(60) # Set frequency to 60 Hz + + +def cycleLEDs(x): + pwm.setPWM(x, 0, leds[x]['minPulseLength']) + time.sleep(random.uniform(leds[x]['waitCeiling'], leds[x]['waitFloor'])) + pwm.setPWM(x, 0, leds[x]['maxPulseLength']) + time.sleep(random.uniform(leds[x]['waitCeiling'], leds[x]['waitFloor'])) + + 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 - pwm.setPWM(x, 0, leds[x]['minPulseLength']) - time.sleep(random.uniform(leds[x]['waitCeiling'],leds[x]['waitFloor'])) - pwm.setPWM(x, 0, leds[x]['maxPulseLength']) - time.sleep(random.uniform(leds[x]['waitCeiling'],leds[x]['waitFloor'])) + cycleLEDs(x) |
