Changeset 615

Show
Ignore:
Timestamp:
06/23/09 18:28:19 (4 years ago)
Author:
behrens
Message:
  • update demos
Location:
trunk
Files:
4 modified
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/ReadMe.txt

    r197 r615  
    33/trunk 
    44 
    5     /demos                      : Folder includes all MATLAB demo files 
     5    /demos          : Folder includes all MATLAB demo files 
    66   
    77    /doc 
    8         /html                   : Html documentation files for the MATLAB toolbox help 
    9             /functions (e.g.) 
    10         /m2html                 : Folder includes MATLAB scripts which are published automatically 
     8    /html           : Html documentation files for the MATLAB toolbox help 
     9    /functions (e.g.) 
     10    /m2html         : Folder includes MATLAB scripts which are published automatically 
    1111   
    12     /mfiles                     : Folder includes all MATLAB files of the toolbox 
    13         /private 
     12    /mfiles         : Folder includes all MATLAB files of the toolbox 
     13    /private 
    1414 
    1515    /publishing 
    16         /output                 : Output folder for the toolbox --> TARGET 
    17         /scripts                : Own scripts to produce a whole toolbox structure 
    18         /tools                  : Tools for publishing process 
    19              /3rdParties        : 3rd party tools 
     16        /output         : Output folder for the toolbox --> TARGET 
     17        /scripts        : Own scripts to produce a whole toolbox structure 
     18        /tools          : Tools for publishing process 
     19            /3rdParties : 3rd party tools 
    2020 
    21     /root                       : Files which are copied in the root folder of the toolbox 
    22          
     21    /root               : Files which are copied in the root folder of the toolbox 
    2322 
    24     /tools                      : Additional tools for the toolbox 
    25         /LinuxConnection        : e.g. bt_connect script 
     23 
     24    /tools              : Additional tools for the toolbox 
     25        /LinuxConnection : e.g. bt_connect script 
     26        /MotorControl    : Advanced Motor Control (NXC program) 
     27 
  • trunk/demos/Example_1_PlayTone.m

    r512 r615  
    11%% Example 1: Play Tone and Get Battery Level 
    22% Example to play a specific tone with the NXT Brick and retrieve the current battery level:  
    3 % 
    43 
    54% Close previous handles (if existing) 
     
    98close all 
    109 
    11 % Open new NXT connection according to the previous generated configuration file.  
    12 handle = COM_OpenNXT('bluetooth.ini', 'check'); 
    13 COM_SetDefaultNXT(handle); 
     10% Open new NXT connection  
     11%  - Tries to open a connection via USB. The first NXT device that is found will be used. 
     12%  - Device drivers (Fantom on Windows, libusb on Linux) have to be already installed for USB to work. 
     13%  - For using Bluetooth a previous configuration file has to be generated COM_MakeBTConfigFile) 
     14handle = COM_OpenNXT(); 
    1415 
    15 %Play tone with frequency 800Hz and duration of 500ms.  
    16 NXT_PlayTone(800,500); 
     16% Play tone with frequency 800Hz and duration of 500ms.  
     17NXT_PlayTone(800,500, handle); 
    1718 
    18 %Get current battery level.  
    19 voltage = NXT_GetBatteryLevel 
     19% Get current battery level.  
     20voltage = NXT_GetBatteryLevel(handle) 
    2021 
    21 %Close Bluetooth connection.  
     22% Close NXT connection.  
    2223COM_CloseNXT(handle); 
  • trunk/demos/Example_2_ReadSoundSensor.m

    r512 r615  
    11%% Example 2: Read Sound Sensor 
    22% Example to read the sound sensor value in db: 
    3  
    43 
    54% Close previous handles (if existing) 
     
    98close all 
    109 
    11 % Open new NXT connection according to the previous generated configuration file.  
     10% Open new NXT Bluetooth connection according to the previous generated configuration file. 
    1211handle = COM_OpenNXT('bluetooth.ini', 'check'); 
     12 
     13% Set current NXT handle as default for subsequent toolbox function calls 
    1314COM_SetDefaultNXT(handle); 
    1415 
    15 % Set the correct sound sensor mode and input port.  
     16% Initialize the sound sensor by setting the sound sensor mode and input port.  
    1617OpenSound(SENSOR_2, 'DB'); 
    1718 
  • trunk/demos/Example_3_DriveAroundTable.m

    r512 r615  
    1 %% Example 3: Drive Around Table 
     1%% Example 3: Drive Around Table (Basic Motor Commands) 
    22% In this little demo, our bot drives a square on the floor around a well known table. 
     3% 
     4% Note: This example uses the basic motor commands, which are based on the LEGO NXT direct commands 
     5% specified by the LEGO Communication Protocol. For advanced motor control (more precise motor 
     6% control) and a more intuitive usability we recommend the advanced motor control commands (see 
     7% example 4). 
    38 
    49%% Clear and close 
     
    1318 
    1419 
    15 %% Open NXT connection 
     20%% Open NXT connection (Bluetooth) 
    1621handle = COM_OpenNXT('bluetooth.ini', 'check'); 
    17 COM_SetDefaultNXT(handle); 
     22COM_SetDefaultNXT(handle);  % set NXT handle as the default handle 
    1823 
    1924 
  • trunk/demos/Example_4_DriveAroundTable_MotorClass.m

    r449 r615  
    1 %% Example 7: Drive Around Table v2 
    2 % This example equals demo 3, but uses the motor class for motor control. 
     1%% Example 7: Drive Around Table (Motor Class) 
     2% This example equals demo 3, but uses the motor class and an advanced motor control. 
     3% 
     4% Note: For using the advanced motor control the MotorControl program has to be downloaded onto your 
     5% NXT. The MotorControl program is located at /tools/MotorControl. 
     6 
    37 
    48%% Clear and close 
     
    1014%% Constants and so on 
    1115TableLength      = 1000;     % in degrees of motor rotations :-) 
    12 QuarterTurnTicks = 217;     % in motor degrees, how much is a 90° turn of the bot? 
    13 Ports = [MOTOR_B; MOTOR_C]; % motorports for left and right wheel 
    14 DrivingSpeed = 50; 
    15 TurningSpeed = 30; 
     16QuarterTurnTicks = 217;      % in motor degrees, how much is a 90° turn of the bot? 
     17Ports = [MOTOR_B; MOTOR_C];  % motorports for left and right wheel 
     18DrivingSpeed     = 50; 
     19TurningSpeed     = 30; 
    1620 
    1721 
    18 %% Open Bluetooth/USB connetion 
     22%% Open Bluetooth connetion 
    1923h = COM_OpenNXT('bluetooth.ini', 'check'); 
    2024COM_SetDefaultNXT(h); 
     
    8387 
    8488 
    85 %% Close Bluetooth 
     89%% Close Bluetooth connection 
    8690COM_CloseNXT(h); 
  • trunk/demos/Example_5_DriveUntilWall.m

    r512 r615  
    1414 
    1515 
    16 %% Initialize NXT connection 
     16%% Initialize NXT connection (Bluetooth) 
    1717handle = COM_OpenNXT('bluetooth.ini', 'check'); 
    1818COM_SetDefaultNXT(handle); 
  • trunk/demos/Example_7_ShinyRadar.m

    r358 r615  
    11%% Example 6: ShinyRadar 
    22% This function provides a live moving ultrasonic radar. 
     3% 
     4% Note: This demo uses an robot with a rotating ultrasonic sensor. 
    35 
    4  
    5 function ShinyRadar 
     6function Example_7_ShinyRadar 
    67 
    78%% Clean up previous handles