Adc

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

clc

close all
clear all

a = arduino('COM5');
Fs = 50; % Frecuencia de muestreo
N = 100; % Tama�o del vector
y = zeros(N,1); % Vector de entrada
x = linspace(0,(N-1)/Fs,N);
l1 = line(nan,nan,'Color','b','LineWidth',2);
ylim([-0.1 5.1])
xlim([0 (N-1)/Fs])
grid

tic
while 1
if toc > 1/Fs
tic
y(1:end-1) = y(2:end);
y(end) = analogRead(a,0)*5/1023;
set(l1,'Xdata',x,'Ydata',y)
drawnow
end

end

You might also like