diff options
| author | gcohen | 2015-01-06 01:39:09 -0800 |
|---|---|---|
| committer | gcohen | 2015-01-06 01:39:09 -0800 |
| commit | 3d666fb09fe90a5cb9de6efe5fab27bf213d604a (patch) | |
| tree | 451f7f122c39270a2db0d0d0dcc1015f33083b54 | |
| parent | ed1b106c1bd878ed2834b0f1c6fef4976985b9f6 (diff) | |
| download | pubnub-python-3d666fb09fe90a5cb9de6efe5fab27bf213d604a.tar.bz2 | |
putting stepper motor functions into own thread
| -rw-r--r-- | python/examples/futureHouse/futureHouse.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/python/examples/futureHouse/futureHouse.py b/python/examples/futureHouse/futureHouse.py index 10ad3b8..318d759 100644 --- a/python/examples/futureHouse/futureHouse.py +++ b/python/examples/futureHouse/futureHouse.py @@ -92,10 +92,16 @@ def callback(message, channel): pubnub.publish(channel, enviro, callback=pubMessage, error=pubMessage) if 'openDoor' in message: - moveDoor("open") - elif 'closeDoor' in message: - moveDoor("close") + try: + thread.start_new_thread( moveDoor, ("open",) ) + except: + print "Error: unable to open door thread" + elif 'closeDoor' in message: + try: + thread.start_new_thread( moveDoor, ("close",) ) + except: + print "Error: unable to close door thread" def error(message): print("ERROR : " + (message)) |
