19 lines
399 B
Python
19 lines
399 B
Python
|
import numpy as np
|
||
|
from multiprocessing import shared_memory
|
||
|
import time
|
||
|
import json
|
||
|
|
||
|
|
||
|
|
||
|
existing_shm = shared_memory.SharedMemory(name="do_shm2")
|
||
|
|
||
|
c = np.ndarray((32,), dtype=np.int32, buffer=existing_shm.buf)
|
||
|
|
||
|
file_path = "./config.json"
|
||
|
while True:
|
||
|
with open(file_path, 'r') as file:
|
||
|
jsonData = json.load(file)
|
||
|
for n in range(32):
|
||
|
c[n]=jsonData[str(n+1)]
|
||
|
time.sleep(2)
|