Error para tomar los datos
Publicado por Guillermo (2 intervenciones) el 26/11/2017 03:49:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%Eliminar el puerto anterior
delete(instrfind({'Port'},{'COM3'}));
%Conexion en serie
s = serial ('COM3','BaudRate',9600);
warning('off','MATLAB:serial:fscanf:unsuccesfulRead');
%Abrir el puerto
fopen(s);
%crear figura del termometro
scrsz = get(0,'ScreenSize');
scr1 = scrsz(3)/4;
scr2 = scrsz(4)/4;
fig = figure('Position', [scr1 scr2 2*scr1 2*scr2],'Name','TErmometro');
hax = axes('Unit','pixels');
v = 1;
fclose(s);
%Tiempo de lectura de datos
for i = 1:10
cla
a(i)=fscanf(s,'%f.%f');
rectangle('Position', [0,-3,3,a(i)], 'FaceColor', 'r')
daspect([1,1,1])
xlim([0,3])
ylim([-5,100])
pause(0.01)
end
plot(a)
tiene error en a(i)=fscanf(s,'%f.%f'); porfa ayudenme con eso
Valora esta pregunta
0