Realtime Data Acquisition and Plotting with Arduino and Python

preview_player
Показать описание
Realtime data acquisition and plotting with an Arduino and a few lines of Python. In this example I use a simple potentiometer to generate the analog signal, but this is exactly how you would acquire and graph the output from any sensor.

Рекомендации по теме
Комментарии
Автор

Brilliant little demo illustrating the simplicity of interfacing Python with Arduino via a serial connection. It's a good idea to flush the read buffer before pulling each reading otherwise you will experience an increasing delay in your plot due to the serial buffer filling up (only the first line of the buffer gets read). Also, I found it necessary to close the serial connection so I can run the script multiple times without having to power-cycle the Arduino.

jefflarsen
Автор

Hello! Thank you very much for your sharing! I'm trying to understand the code and I have 2 questions: 1) What would I have to do to make the zero stay as the first point in the x axis? and 2) I got an error with the Line that +Jeffrey Larsen added, an It tells me that "'Serial' object has no attribute 'reset_input_buffer'", it could be because of the py version I'm using?

Thanks in advance!

PD: Sorry for my poor english, I'm spanish speaker native. Hope you could understand my questions! Thanks again! :)

Chilanglik
Автор

hello ..
I've tried the code, but there's still an error I get. Can you help me?
this error :
data = ser.readline().split(' ')
TypeError: a bytes-like object is required, not 'str'

thank you

dekarachmad