I
I
iva20002020-02-24 15:46:48
Python
iva2000, 2020-02-24 15:46:48

Is it possible to synchronize data streams from two com ports in pyhton?

I am writing technical specifications for the program, I don’t understand whether my fantasies are realizable.

Introductory: An arduino hangs on one com port, which controls the motors that move the sensor. The sensor is connected to another com port.

Simplified question: is it possible to log once per second the value from the sensor and the corresponding value of the sensor coordinate? Will there be desynchronization?

Complicated question: The sensor transmits 6000 values ​​per second, these values ​​per second must be averaged. Arduina about once a second (sometimes a little less often) transmits new sensor coordinates. I suppose to continuously write to the stack with a length of 6000 values ​​​​from the sensor, and when the arduina sends a signal about a new coordinate, remember this new coordinate, wait half a second, and write the stored coordinate and the average value from the sensor for the previous second to the log.
Can I use this method to write down the unambiguous corresponding to each other coordinates of the sensor and the signal from it?
How much desynchronization will I have to accept?
Where are the pitfalls?

What to read to understand how such things are done correctly in Phyton?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question