Skip to content Skip to sidebar Skip to footer

Storing Serial Value After The Loop Is Done From The Arduino Side

I have similar question with the link below. How to store value in list (python) which is coming from arduino serially? For his output will look like [2.00] [2.00,2.64] [2.00,2.6

Solution 1:

As it is specified in the answer related to your question: How to store value in list (python) which is coming from arduino serially?, code looks like the following.

import serial
arduino = serial.Serial('COM12', 9600, timeout = .1)
arduino_data = [] # declare a listwhileTrue:
    data = arduino.readline()
    if data:
        arduino_data.append(data) # Append a data to your declared listprint arduino_data

At last, when while loop is done, all data has been appended to the list named arduino_data. Thus, access the list outside the while loop and you may achieve whatever you are trying to accomplish. It is simply printing the data serially, but at last everything is getting appended to that list.

Hope it helps!

Post a Comment for "Storing Serial Value After The Loop Is Done From The Arduino Side"