Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use multithreading. almost works.

  • Loading branch information...
commit 0a6853ca3f45a2cc2efd7e5029e0ed9fc9e36e2f 1 parent 6d68c7d
@cibomahto cibomahto authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 host/domelistener.py
View
15 host/domelistener.py
@@ -1,7 +1,7 @@
import socket
import time
import Queue
-import threading
+import multiprocessing
import LedStrips
# UDP settings
@@ -16,17 +16,19 @@
# Serial port settings
strip_names = [
['/dev/tty.usbmodem12341', 0],
- ['/dev/tty.usbmodem107', 8],
- ['/dev/tty.usbmodem108', 16],
+ ['/dev/tty.usbmodem121', 8],
]
-class threadedLedStrips(threading.Thread):
- q = Queue.Queue(1)
+class threadedLedStrips(multiprocessing.Process):
+ q = multiprocessing.Queue(2)
def __init__(self, port_name, offset):
- threading.Thread.__init__(self)
+ self.port_name = port_name
+ self.offset = offset
+
+ multiprocessing.Process.__init__(self, target=self.run)
self.strip = LedStrips.LedStrips(offset)
self.strip.connect(port_name)
@@ -34,7 +36,6 @@ def run(self):
while True:
command = self.q.get()
self.strip.draw(command,image_width)
- self.q.task_done()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Please sign in to comment.
Something went wrong with that request. Please try again.