Azzera filtri
Azzera filtri

How to plot a graph with x and y axis input live from two hardware (arduino and laser gauge- UART)

3 visualizzazioni (ultimi 30 giorni)
Hi,
I'm a newbie to matlab. I'm trying to plot a graph where realtime data is received from a laser gauge using serial input (FT232), and pressure reading from a sensor using arduino. I tried to interface both the hardware to arduino but it wasn't an option recommended by the tech for the laser gauge and wasn't working.Serial signal was verified to work with tera term. Now I built up a code to receive that in matlab. I would like some help on how to now integrate that code to plot where the x axis is the source from arduino.
%
close all;
%serial object
s = serialport('COM4','BaudRate',9600);
% open serial port
fopen(s);
%plotting data
i=1;
while (1)
data (i) = str2double(fscanf(s));
if i <= 150
plot(data);
else
plot(data(end-150:end));
ylim([0 5]);
pause(0.01);
i=i+1;
end
  3 Commenti
Mohammed Ammad
Mohammed Ammad il 13 Nov 2022
Is it possible to get the data for the x and y axis from the hardware to plot the graph for 7 seconds and then stay idle?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB Support Package for Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by