Changeset 730
- Timestamp:
- 07/20/09 19:55:48 (4 years ago)
- Location:
- trunk/demos
- Files:
-
- 3 removed
- 3 modified
- 2 moved
-
. (modified) (1 prop)
-
Example_1_PlayTone.m (modified) (2 diffs)
-
Example_2_ReadSoundSensor.m (modified) (2 diffs)
-
Example_3_DriveAroundTable.m (deleted)
-
Example_3_DriveAroundTable_MotorClass.m (moved) (moved from trunk/demos/Example_4_DriveAroundTable_MotorClass.m) (4 diffs)
-
Example_4_NextGenerationUltrasound.m (moved) (moved from trunk/demos/Example_6_NextGenerationUltrasound.m) (3 diffs)
-
Example_5_DriveUntilWall.m (deleted)
-
Example_7_ShinyRadar.m (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos
-
Property
svn:ignore set
to
*.asv
-
Property
svn:ignore set
to
-
trunk/demos/Example_1_PlayTone.m
r615 r730 1 1 %% Example 1: Play Tone and Get Battery Level 2 2 % Example to play a specific tone with the NXT Brick and retrieve the current battery level: 3 4 % Signature 5 % Author: Linus Atorf, Alexander Behrens 6 % Date: 2009/07/17 7 % License: BSD 8 % RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 9 10 % verify that the RWTH - Mindstorms NXT toolbox is installed. 11 if verLessThan('RWTHMindstormsNXT', '2.00'); 12 error('This program requires the RWTH - Mindstorms NXT Toolbox version 2.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 13 end%if 14 3 15 4 16 % Close previous handles (if existing) … … 12 24 % - Device drivers (Fantom on Windows, libusb on Linux) have to be already installed for USB to work. 13 25 % - For using Bluetooth a previous configuration file has to be generated COM_MakeBTConfigFile) 26 % - This call will not try to open a Bluetooth connection... 14 27 handle = COM_OpenNXT(); 28 % at this place we could call COM_SetDefaultNXT(handle); 15 29 16 30 % Play tone with frequency 800Hz and duration of 500ms. -
trunk/demos/Example_2_ReadSoundSensor.m
r668 r730 1 1 %% Example 2: Read Sound Sensor 2 2 % Example to read the sound sensor value in db: 3 4 % Signature 5 % Author: Linus Atorf, Alexander Behrens 6 % Date: 2009/07/17 7 % License: BSD 8 % RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 9 10 % verify that the RWTH - Mindstorms NXT toolbox is installed. 11 if verLessThan('RWTHMindstormsNXT', '2.00'); 12 error('This program requires the RWTH - Mindstorms NXT Toolbox version 2.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 13 end%if 14 3 15 4 16 % Close previous handles (if existing) … … 9 21 10 22 % Open new NXT Bluetooth connection according to the previous generated configuration file. 23 % Please note that a USB connection will be used if one is present. If no 24 % USB device is found, the Bluetooth configuration file will be used. 11 25 handle = COM_OpenNXT('bluetooth.ini'); 12 26 -
trunk/demos/Example_3_DriveAroundTable_MotorClass.m
r669 r730 1 %% Example 7: Drive Around Table (Motor Class)2 % This example equals demo 3, but uses the motor class and an advanced motor control.1 %% Example 3: Drive Around Table (Motor Class) 2 % Let's a robot (e.g. Tribot or CATTbot) to drive a square on the floor 3 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. 4 % Signature 5 % Author: Linus Atorf, Alexander Behrens 6 % Date: 2009/07/17 7 % License: BSD 8 % RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 9 10 % verify that the RWTH - Mindstorms NXT toolbox is installed. 11 if verLessThan('RWTHMindstormsNXT', '3.00'); 12 error('This program requires the RWTH - Mindstorms NXT Toolbox version 3.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 13 end%if 6 14 7 15 … … 14 22 %% Constants and so on 15 23 TableLength = 1000; % in degrees of motor rotations :-) 16 QuarterTurnTicks = 21 7; % in motor degrees, how much is a 90° turn of the bot?24 QuarterTurnTicks = 219; % in motor degrees, how much is a 90° turn of the bot? 17 25 Ports = [MOTOR_B; MOTOR_C]; % motorports for left and right wheel 18 DrivingSpeed = 50;19 TurningSpeed = 30;26 DrivingSpeed = 60; 27 TurningSpeed = 40; 20 28 21 29 … … 34 42 mStraight.Power = DrivingSpeed; 35 43 mStraight.TachoLimit = TableLength; 36 mStraight. BrakeAtTachoLimit = true;44 mStraight.ActionAtTachoLimit = 'Brake'; 37 45 38 46 39 47 mTurn1 = NXTMotor(Ports(2)); % ports swapped because it's nicer 40 mTurn1.SpeedRegulation = true;48 mTurn1.SpeedRegulation = false; % we could use it if we wanted 41 49 mTurn1.Power = TurningSpeed; 42 50 mTurn1.TachoLimit = QuarterTurnTicks; 43 m Turn1.BrakeAtTachoLimit = true;51 mStraight.ActionAtTachoLimit = 'Brake'; 44 52 45 53 … … 81 89 82 90 83 84 91 % Hey! End of a hard day's work 85 92 % Just to show good style, we close down our motors again: -
trunk/demos/Example_4_NextGenerationUltrasound.m
r615 r730 1 %% Example 5: Next Generation Ultrasound1 %% Example 4: Next Generation Ultrasound 2 2 % This script demonstrates the results of the ultrasound "snapshot mode"! 3 3 % Interpretation of the results however is difficult. … … 6 6 % SENSOR_2), and see what's happening. The script will exit after 200 7 7 % measurements... 8 % 9 % Signature 10 % Author: Linus Atorf, Alexander Behrens 11 % Date: 2009/07/17 12 % License: BSD 13 % RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 14 15 % verify that the RWTH - Mindstorms NXT toolbox is installed. 16 if verLessThan('RWTHMindstormsNXT', '2.00'); 17 error('This program requires the RWTH - Mindstorms NXT Toolbox version 3.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 18 end%if 8 19 9 20 … … 11 22 % Close previous handles (if existing) 12 23 COM_CloseNXT all 24 13 25 14 26 %% Set up Matlab
