close all
clear all
clc

globalVar;
N=50;
time=zeros(1,N);
val=zeros(4,N);

calibSensor1=32;
calibSensor2=43;
calibSensor3=16;
calibSensor4=25;

H=initCom;
%tic
%for i=1:1:N
while(1)
adc=input('ADC: ');
%sendMessageADC(H,adc);
 %   for j=1:1:4
        sendMessageADC(H,adc);
    
        [r1,r2]=readMessageADC(H);
        val=(r1*256)+r2
  %  end
%   time(1,i)=toc;
end

% time=time-time(1);
% val(1,:)=val(1,:)-calibSensor1;
% val(2,:)=val(2,:)-calibSensor2;
% val(3,:)=val(3,:)-calibSensor3;
% val(4,:)=val(4,:)-calibSensor4;
% 
% sensors.val=val;
% %sensors.time=time;
% save .\results\sensors_mov sensors
% 
% val=sensors.val*3300/1023;
% t=1:1:250;
% plot(t,val(1,t),'*-',t,val(2,t),'*-',t,val(3,t),'*-',t,val(4,t),'*-')
% hold on
% axis([0 250 0 3500])
% legend('Load Button 1','Load Button 2','Load Button 3','Load Button 4')
% title('Load Button Results')
% ylabel('Voltage (mV)')
% xlabel('Sample')
% hold off
% 
% 
% 
% killCom(H);