mirror of
https://gitlab.com/triple-hops-brewed/raspberry-pi-stock-ticker.git
synced 2025-06-15 14:56:38 +00:00
code to test led ticker without using pi
This commit is contained in:
parent
d141954112
commit
15c7154c05
45
sim.py
Normal file
45
sim.py
Normal file
@ -0,0 +1,45 @@
|
||||
#%%
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.animation import FuncAnimation
|
||||
import numpy as np
|
||||
|
||||
#%%
|
||||
matrixSize = (32, 64, 3)
|
||||
#%%
|
||||
a = np.random.randint(1, high=256, size=(32, 128, 3))
|
||||
|
||||
# for i in range(10):
|
||||
# a = np.delete(a,0,1)
|
||||
# a.shape
|
||||
|
||||
#%%
|
||||
plt.imshow(a[:, :64])
|
||||
plt.show()
|
||||
|
||||
#%%
|
||||
blank = np.zeros(matrixSize, dtype=int)
|
||||
noise = np.random.randint(1, high=256, size=(32, 128, 3))
|
||||
|
||||
#%%
|
||||
buffer = np.concatenate((blank, noise), axis=1)
|
||||
|
||||
|
||||
#%%
|
||||
plt.imshow(buffer[:, :64])
|
||||
plt.show()
|
||||
|
||||
|
||||
#%%
|
||||
fig = plt.figure(figsize=matrixSize[0:2], facecolor="black")
|
||||
|
||||
|
||||
def update():
|
||||
np.delete(buffer, 0, 1)
|
||||
|
||||
|
||||
plt.imshow(buffer[:, :64])
|
||||
ani = FuncAnimation(fig, update, frames=buffer.shape[1])
|
||||
plt.show()
|
||||
|
||||
|
||||
#%%
|
Loading…
x
Reference in New Issue
Block a user