# This is a function to process the list of cell voltage data def process_list(v): # Creating one long string alleviates the problem of having 1/2 a voltage on each message # Discard first 3 bytes of the first message since it has only 2 voltages v_string = "".join(v[0:29])[3*8:] # Create an empty list to store the voltage of each cell voltages = [0.0] * 96 for i in range(0, 96): # Each cell has a 16 bit value. Extract the next 16 bits and convert it into a float voltages[i] = float(int(v_string[(i*16):(i*16+16)], 2)) # Divide by 1000 to get the final value voltages[i] = voltages[i]/1000. # Print the voltage of the cell to the console #print("Cell " + str(i+1) + " = %.3f" % voltages[i]) return voltages