%% a handle designed for the LabJack T7 to read from AIN0-1 %everything concerning the communication is specified in this class: %contains a simple read, data streaming and can notify listeners at %fixed intervals classdef LJ_Handle 179.6)|| angle > 345); % if ~validStream; obj.streamStop; obj.streamStart;end; % % end end function streamStop(obj) if obj.streamStarted err=calllib('libLabJackM','LJM_eStreamStop',obj.nr); if obj.errChecker; errCheck(err); end; obj.streamStarted=false; else disp('NO STREAM TO STOP!') end end %read from stream at fixed rate (obj.Rate) function [data,LJMScanBacklog,DeviceScanBacklog]=streamRead(obj) %writeName(obj,'STREAM_SETTLING_US',200); %not really clear what the difference between LJMScanBacklog %and DeviceScanBacklog is [err, data, DeviceScanBacklog , LJMScanBacklog]= calllib('libLabJackM','LJM_eStreamRead',obj.nr,obj.data,obj.DeviceScanBacklog,obj.LJMScanBacklog); if obj.errChecker; errCheck(err); end; data(2,:)=data(2,:)* 10/LJ_Handle.range; data(2,:)=(data(2,:)-5)*360/10; % set a limit to the lever movement at 0 and 180 deg if data(2,:)<-90 data(2,:)=180; end if data(2,:)<0 data(2,:)=0; end %this returns the time-stamps for the stream at every single point %because the time is 32 bit and streaming is only possible for %16bit channels stream_data_capture_16 captures the second half %of the data. data(3,:) + 65536*data(4,:) returns the proper value. % 1//40000000.0 returns the time in sec. %data(3,:)=(data(3,:) + 65536*data(4,:))/40000000.0; end function close(obj) err= calllib('libLabJackM','LJM_Close',obj.nr); if obj.errChecker; errCheck(err); end; end end end