Hey there, I need to make a application in which i need to display graph for sensor reading, I am reading temerature sensor light sensor accelerator sensor. and these option is in check box, firstly when i click connect button the temperature sensor should be in graph only then when i click checkbox the line should appear in graph, when i uncheck it line should disappear, and all the line should be in single graph.
I am posting my code which is only dummy but data is live from arduino.
clear all; global a; % global p1; % global p2;
tempflag =0; global secondflag; secondflag = 0; iter =1; a = arduino('COM7', 'Uno');
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) set(handles.axes1, 'Visible','on'); % %
x=0; global a; global tempflag;
while 1 % disp(tempflag);
v=readVoltage(a,'A0');
analog = (v/0.0048875);
temp = -(analog * 0.48828125);
x = [x temp];
handles.p1 = plot(handles.axes1 , x, 'color', 'blue');
set(handles.p1, 'tag', 'p1');
subplot(2, 2, [1 3]);
legend('Temperature','Location', 'southwest');
xlabel('Time')
ylabel('Temerature')
grid;
set(handles.edit1,'String', num2str(temp));
pause(0.5);
end
if(value == 0) % delete(findobj('tag','p1')); set(findobj('tag','p1'), 'Visible', 'off') ; hold on; % tempflag =1;
iter = 0; elseif (value == 1) % set(findobj('tag','p1'), 'Visible', 'on') ; % tempflag =0; %show again
end
please help me on this
0 Comments
Sign in to comment.