From 3d666fb09fe90a5cb9de6efe5fab27bf213d604a Mon Sep 17 00:00:00 2001 From: gcohen Date: Tue, 6 Jan 2015 01:39:09 -0800 Subject: putting stepper motor functions into own thread --- python/examples/futureHouse/futureHouse.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'python/examples') 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)) -- cgit v1.2.3