receiver test
This commit is contained in:
parent
fc2a1641b9
commit
153f5872ab
2 changed files with 39 additions and 0 deletions
21
receiver.py
Normal file
21
receiver.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import send_test_data
|
||||
import json
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
data_store = []
|
||||
data_buffer = []
|
||||
times = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
||||
|
||||
for data in send_test_data.data_test_forever():
|
||||
currentdata = json.loads(data)
|
||||
data_store.append(currentdata["V"])
|
||||
data_buffer = data_store[-20:]
|
||||
|
||||
# draw graph
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(times[:len(data_buffer)], data_buffer)
|
||||
plt.xticks(np.arange(1, 21, 1))
|
||||
plt.yticks(np.arange(0, 257, 32))
|
||||
plt.show()
|
||||
plt.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue