I want to do this with a circular buffer(that is x as deque)
i = 0
x = []
while True:
accel_data = sensor.get_accel()
d = datetime.utcnow().strftime('%Y-%m-%d')
t = datetime.utcnow().strftime('%H:%M:%S.%f')
x.append(accel_data + (d, t))
i = i + 1
I know how to implement a simple circular buffer:
from collections import deque
import time
d = deque(maxlen=4)
bool = True
i = 1
y = 0
while bool:
d.append(i)
i = i + 1
print(d)
time.sleep(1)
But I can’t use it to reproduce the first code.