Changeset 296

Show
Ignore:
Timestamp:
09/25/08 13:47:33 (5 years ago)
Author:
behrens
Message:

replaced f_sensorport to port

Location:
branches/atorf/RWTHMindstormsNXT
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/atorf/RWTHMindstormsNXT/GetUltrasonic.m

    r275 r296  
    1 function [DistanceCM] = GetUltrasonic(f_sensorport) 
     1function [DistanceCM] = GetUltrasonic(port) 
    22% Reads the current value of the NXT ultrasonic sensor 
    33% 
     
    4545 
    4646    % also accept strings as input 
    47     if ischar(f_sensorport) 
    48         f_sensorport = str2double(f_sensorport); 
     47    if ischar(port) 
     48        port = str2double(port); 
    4949    end%if 
    5050 
     
    5656 
    5757    % retrieve 1 byte from device 0x02, register 0x42 
    58     data = COM_ReadI2C(f_sensorport, 1, uint8(2), uint8(66)); 
     58    data = COM_ReadI2C(port, 1, uint8(2), uint8(66)); 
    5959     
    6060    if isempty(data) 
  • branches/atorf/RWTHMindstormsNXT/OpenUltrasonic.m

    r291 r296  
    1 function [] = OpenUltrasonic(f_sensorport, varargin) 
     1function [] = OpenUltrasonic(port, varargin) 
    22% Initializes and sets the mode of the NXT ultrasonic sensor 
    33% 
     
    6565%% Parameter check 
    6666    % also accept strings as input 
    67     if ischar(f_sensorport) 
    68         f_sensorport = str2double(f_sensorport); 
     67    if ischar(port) 
     68        port = str2double(port); 
    6969    end%if 
    7070 
     
    7878     
    7979     
    80     NXT_SetInputMode(f_sensorport, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); 
     80    NXT_SetInputMode(port, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); 
    8181 
    8282 
     
    9494        I2Cdata(3) = hex2dec('01'); % SINGLE_SHOT 
    9595         
    96         NXT_LSWrite(f_sensorport, RequestLen, I2Cdata, 'dontreply'); 
     96        NXT_LSWrite(port, RequestLen, I2Cdata, 'dontreply'); 
    9797         
    9898    else 
     
    104104        I2Cdata(3) = hex2dec('02'); % CONTINUOUS_MEASUREMENT 
    105105         
    106         NXT_LSWrite(f_sensorport, RequestLen, I2Cdata, 'dontreply'); 
     106        NXT_LSWrite(port, RequestLen, I2Cdata, 'dontreply'); 
    107107    end%if 
    108108     
     
    114114    % the following command sequence is not clearly documented but was 
    115115    % found to work well! 
    116         NXT_LSGetStatus(f_sensorport); % flush out data with Poll 
     116        NXT_LSGetStatus(port); % flush out data with Poll 
    117117    % we request the status-byte so that it doesn't get checked. 
    118118    % errors that can occur here are: 
     
    120120    %Packet (reply to LSREAD) contains error message 224: "Specified 
    121121    %channel/connection not configured or busy" 
    122         [a b c] = NXT_LSRead(f_sensorport);      % flush out data with Poll? 
     122        [a b c] = NXT_LSRead(port);      % flush out data with Poll? 
    123123 
    124124end%function