-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaster.py
executable file
·41 lines (34 loc) · 960 Bytes
/
master.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import settings
import time
import random
import multiprocessing
import numpy as np
import lasair
# The first is a matplotlib screen, the second for the real matriz
if settings.RGBmatrix:
from led_matrix import init, show
else:
from screen import init, show
# The first is for mock kafka, the second for the real thing
if settings.realKafka:
import kafka
else:
import mockkafka as kafka
n = settings.npix
L = lasair.state(n)
def run_display(pass_shmarray):
global L
shmarray = pass_shmarray
matrix = init()
while 1:
a = L.display(shmarray)
show(a, matrix)
time.sleep(settings.lasair_delay)
if __name__ == '__main__':
array = multiprocessing.Array("i", n*n)
process1 = multiprocessing.Process(target=kafka.get_kafka, args=[array])
process2 = multiprocessing.Process(target=run_display, args=[array])
process1.start()
process2.start()
process1.join()
process2.join()