Hello, I'm currently reading and printing data from an arduino via serial USB in a loop and would like to store the data and add it up after 60 seconds has passed to display the result. The data being sent is in a float format (0.00) that represent seconds and milliseconds. I was looking at lists and different ways of storing the data but I'm not sure what the most efficient way of doing or where to start. Any and all help would be greatly appreciated!
import serial import os if __name__ == '__main__': ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1) ser.flush() while True: if ser.in_waiting > 0: value = ser.readline().decode('utf-8').rstrip() #reading from serial. It's a float 0.00 (second.milliseconds) runTime = float(value) #convert variable to float. print(runTime) #prints variable result.