Changeset 282
- Timestamp:
- 09/22/08 16:39:39 (5 years ago)
- Location:
- branches/telle/RWTHMindstormsNXT-Lejos
- Files:
-
- 100 modified
-
COM_CloseNXT.m (modified) (6 diffs)
-
COM_CollectPacket.m (modified) (4 diffs)
-
COM_CreatePacket.m (modified) (3 diffs)
-
COM_GetDefaultNXT.m (modified) (2 diffs)
-
COM_MakeBTConfigFile.m (modified) (2 diffs)
-
COM_OpenNXT.m (modified) (2 diffs)
-
COM_OpenNXTEx.m (modified) (1 diff)
-
COM_SendPacket.m (modified) (2 diffs)
-
COM_SetDefaultNXT.m (modified) (2 diffs)
-
CloseSensor.m (modified) (3 diffs)
-
DebugMode.m (modified) (2 diffs)
-
GetLight.m (modified) (2 diffs)
-
GetMemoryCount.m (modified) (3 diffs)
-
GetMotor.m (modified) (2 diffs)
-
GetMotorSettings.m (modified) (2 diffs)
-
GetSound.m (modified) (2 diffs)
-
GetSwitch.m (modified) (2 diffs)
-
GetUltrasonic.m (modified) (2 diffs)
-
MAP_GetCommModule.m (modified) (2 diffs)
-
MAP_GetInputModule.m (modified) (2 diffs)
-
MAP_GetOutputModule.m (modified) (2 diffs)
-
MAP_GetSoundModule.m (modified) (2 diffs)
-
MAP_GetUIModule.m (modified) (2 diffs)
-
MAP_SetOutputModule.m (modified) (3 diffs)
-
MOTOR_A.m (modified) (2 diffs)
-
MOTOR_B.m (modified) (2 diffs)
-
MOTOR_C.m (modified) (2 diffs)
-
MotorRotateAbs.m (modified) (3 diffs)
-
NXT_GetBatteryLevel.m (modified) (2 diffs)
-
NXT_GetFirmwareVersion.m (modified) (2 diffs)
-
NXT_GetInputValues.m (modified) (3 diffs)
-
NXT_GetOutputState.m (modified) (2 diffs)
-
NXT_LSGetStatus.m (modified) (3 diffs)
-
NXT_LSRead.m (modified) (3 diffs)
-
NXT_LSWrite.m (modified) (3 diffs)
-
NXT_PlaySoundFile.m (modified) (2 diffs)
-
NXT_PlayTone.m (modified) (2 diffs)
-
NXT_ReadIOMap.m (modified) (2 diffs)
-
NXT_ResetInputScaledValue.m (modified) (2 diffs)
-
NXT_ResetMotorPosition.m (modified) (2 diffs)
-
NXT_SendKeepAlive.m (modified) (3 diffs)
-
NXT_SetBrickName.m (modified) (2 diffs)
-
NXT_SetInputMode.m (modified) (4 diffs)
-
NXT_SetOutputState.m (modified) (2 diffs)
-
NXT_StartProgram.m (modified) (2 diffs)
-
NXT_StopProgram.m (modified) (2 diffs)
-
NXT_StopSoundPlayback.m (modified) (2 diffs)
-
NXT_WriteIOMap.m (modified) (2 diffs)
-
OpenLight.m (modified) (2 diffs)
-
OpenSound.m (modified) (2 diffs)
-
OpenSwitch.m (modified) (2 diffs)
-
OpenUltrasonic.m (modified) (2 diffs)
-
README (modified) (1 diff)
-
README.txt (modified) (1 diff)
-
ResetMotorAngle.m (modified) (2 diffs)
-
SENSOR_1.m (modified) (2 diffs)
-
SENSOR_2.m (modified) (2 diffs)
-
SENSOR_3.m (modified) (2 diffs)
-
SENSOR_4.m (modified) (2 diffs)
-
SendMotorSettings.m (modified) (3 diffs)
-
SetAngleLimit.m (modified) (3 diffs)
-
SetMemoryCount.m (modified) (3 diffs)
-
SetMotor.m (modified) (2 diffs)
-
SetPower.m (modified) (2 diffs)
-
SetRampMode.m (modified) (2 diffs)
-
SetTurnRatio.m (modified) (3 diffs)
-
SpeedRegulation.m (modified) (3 diffs)
-
StopMotor.m (modified) (3 diffs)
-
SwitchLamp.m (modified) (3 diffs)
-
SyncToMotor.m (modified) (3 diffs)
-
USGetSnapshotResults.m (modified) (3 diffs)
-
USMakeSnapshot.m (modified) (2 diffs)
-
WaitForMotor.m (modified) (3 diffs)
-
checkStatusByte.m (modified) (2 diffs)
-
private/byte2outputmode.m (modified) (2 diffs)
-
private/byte2regmode.m (modified) (2 diffs)
-
private/byte2runstate.m (modified) (2 diffs)
-
private/byte2sensormode.m (modified) (2 diffs)
-
private/byte2sensortype.m (modified) (2 diffs)
-
private/checkHandleStruct.m (modified) (1 diff)
-
private/commandbyte2name.m (modified) (2 diffs)
-
private/createHandleStruct.m (modified) (1 diff)
-
private/dec2wordbytes.m (modified) (2 diffs)
-
private/fantom_proto.m (modified) (1 diff)
-
private/getReplyLengthFromCmdByte.m (modified) (2 diffs)
-
private/getVISAErrorString.m (modified) (2 diffs)
-
private/initializeGlobalMotorStateVar.m (modified) (2 diffs)
-
private/isdebug.m (modified) (2 diffs)
-
private/libusb_proto.m (modified) (1 diff)
-
private/name2commandbytes.m (modified) (2 diffs)
-
private/outputmode2byte.m (modified) (2 diffs)
-
private/regmode2byte.m (modified) (2 diffs)
-
private/runstate2byte.m (modified) (2 diffs)
-
private/sensormode2byte.m (modified) (2 diffs)
-
private/sensortype2byte.m (modified) (2 diffs)
-
private/wordbytes2dec.m (modified) (2 diffs)
-
readFromIniFile.m (modified) (3 diffs)
-
textOut.m (modified) (3 diffs)
-
tictic.m (modified) (2 diffs)
-
toctoc.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/telle/RWTHMindstormsNXT-Lejos/COM_CloseNXT.m
r247 r282 3 3 % 4 4 % Syntax 5 % COM_CloseNXT(handle)6 % 7 % COM_CloseNXT('all')8 % 9 % COM_CloseNXT('all', inifilename)5 % |COM_CloseNXT(handle)| 6 % 7 % |COM_CloseNXT('all')| 8 % 9 % |COM_CloseNXT('all', inifilename)| 10 10 % 11 11 % … … 14 14 % occupied by the handle) by calling this method. After the clean up 15 15 % invoked by this call, an NXT brick can be accessed and used again (by 16 % COM_OpenNXT or COM_OpenNXTEx.17 % 18 % COM_CloseNXT(handle)will close and erase the specified device.19 % handlehas to be a valid handle struct created by either20 % COM_OpenNXT or COM_OpenNXTEx.21 % 22 % COM_CloseNXT('all')will close and erase all existing NXT devices16 % |COM_OpenNXT| or |COM_OpenNXTEx|. 17 % 18 % |COM_CloseNXT(handle)| will close and erase the specified device. 19 % |handle| has to be a valid handle struct created by either 20 % |COM_OpenNXT| or |COM_OpenNXTEx|. 21 % 22 % |COM_CloseNXT('all')| will close and erase all existing NXT devices 23 23 % from memory (as long as the toolbox could keep track of them). All USB 24 24 % handles will be destroyed, all open serial ports (for Bluetooth … … 26 26 % program to create a "fresh start" and a well-defined starting 27 27 % environment. 28 % Please note that a clear allcommand can cause this function to fail28 % Please note that a |clear all| command can cause this function to fail 29 29 % (in such a way, that not all open USB devices can be closed, since all 30 30 % information about them has be cleare from MATLAB's memory). If this 31 31 % happens, an NXT device might appear to be busy and cannot be used. 32 32 % Usually rebooting the NXT helps, if not try to restart MATLAB as well. 33 % So be careful with using clear all beforeCOM_CloseNXT('all').34 % 35 % COM_CloseNXT('all', inifilename)will do the same as above, but33 % So be careful with using |clear all| before |COM_CloseNXT('all'). 34 % 35 % |COM_CloseNXT('all', inifilename)| will do the same as above, but 36 36 % instead of closing all open serial ports, only the COM-Port specified 37 % in inifilenamewill be used (a valid Bluetooth configuration file can be38 % created by the function COM_MakeBTConfigFile).37 % in |inifilename| will be used (a valid Bluetooth configuration file can be 38 % created by the function |COM_MakeBTConfigFile|). 39 39 % This syntax helps to avoid interference with other serial ports that might 40 40 % be used by other (MATLAB) programs at the same time. Note that still all open … … 43 43 % 44 44 % Limitations 45 % If you call COM_CloseNXT('all') after a clear allcommand has been45 % If you call |COM_CloseNXT('all')| after a |clear all| command has been 46 46 % issued, the function will not be able to close all remaining open USB 47 47 % handles, since they have been cleared out of memory. This is a problem 48 48 % on Linux systems. You will not be able to use the NXT device without 49 49 % rebooting it. 50 % Solution: Either use only clearin your programs, or you use the51 % COM_CloseNXT('all') statement before clear all.50 % Solution: Either use only |clear| in your programs, or you use the 51 % |COM_CloseNXT('all')| statement before |clear all|. 52 52 % The best way however is to track your handles carefully and close them 53 53 % manually before exiting whenever possible! … … 55 55 % 56 56 % Example 57 % handle = COM_OpenNXT('bluetooth.ini', check');58 % COM_SetDefaultNXT(handle);59 % NXT_PlayTone(440,10);60 % COM_CloseNXT(handle);57 %+ handle = COM_OpenNXT('bluetooth.ini', check'); 58 %+ COM_SetDefaultNXT(handle); 59 %+ NXT_PlayTone(440,10); 60 %+ COM_CloseNXT(handle); 61 61 % 62 62 % See also: COM_OpenNXT, COM_OpenNXTEx, COM_MakeBTConfigFile, COM_SetDefaultNXT … … 67 67 % Copyright: 2007-2008, RWTH Aachen University 68 68 % 69 ; 69 70 % 70 71 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_CollectPacket.m
r247 r282 3 3 % 4 4 % Syntax 5 % [type cmd statusbyte content] = COM_CollectPacket(handle)6 % 7 % [type cmd statusbyte content] = COM_CollectPacket(handle, 'dontcheck')5 % |[type cmd statusbyte content] = COM_CollectPacket(handle)| 6 % 7 % |[type cmd statusbyte content] = COM_CollectPacket(handle, 'dontcheck')| 8 8 % 9 9 % Description 10 % [type cmd statusbyte content] = COM_CollectPacket(handle)reads one packet on the communication11 % channel specified by the handlestruct (PC system: handle struct containing e.g. serial10 % |[type cmd statusbyte content] = COM_CollectPacket(handle)| reads one packet on the communication 11 % channel specified by the |handle| struct (PC system: handle struct containing e.g. serial 12 12 % handle, Linux system: handle struct containing file handle). The USB / Bluetooth handle 13 % struct can be obtained by the COM_OpenNXT or COM_GetDefaultNXTcommand. The return14 % value typespecifies the telegram type according to the LEGO Mindstorms communication15 % protcol. The cmd value determines the specific command. statusindicates if an error16 % occured on the NXT brick. The function checkStatusByteis interpreting this information17 % per default. The contentcolumn vector represents the remaining payload of the whole return packet. E.g. it13 % struct can be obtained by the |COM_OpenNXT| or |COM_GetDefaultNXT| command. The return 14 % value |type| specifies the telegram type according to the LEGO Mindstorms communication 15 % protcol. The |cmd| value determines the specific command. |status| indicates if an error 16 % occured on the NXT brick. The function |checkStatusByte| is interpreting this information 17 % per default. The |content| column vector represents the remaining payload of the whole return packet. E.g. it 18 18 % contains the current battery level in milli volts, that then has to be converted to a valid 19 % integer from its byte representation (i.e. using wordbytes2dec).20 % 21 % [type cmd statusbyte content] = COM_CollectPacket(handle, 'dontcheck')disables the validation22 % check of the status value by function checkStatusBytes.19 % integer from its byte representation (i.e. using |wordbytes2dec|). 20 % 21 % |[type cmd statusbyte content] = COM_CollectPacket(handle, 'dontcheck')| disables the validation 22 % check of the |status| value by function |checkStatusBytes|. 23 23 % 24 24 % varargin : set to 'dontcheck' if the status byte should not … … 32 32 % This function uses the specific Bluetooth settings from the ini-file 33 33 % that was specified when opening the handle. Parameters used here are 34 % SendSendPause and SendReceivePause, which will cause this function34 % |SendSendPause| and |SendReceivePause|, which will cause this function 35 35 % to wait a certain amount of milliseconds between each consecutive send 36 36 % or receive operation to avoid packet loss or buffer overflows inside … … 38 38 % 39 39 % Example 40 % COM_MakeBTConfigFile();41 % 42 % handle = COM_OpenNXT('bluetooth.ini', 'check');43 % 44 % [type cmd] = name2commandbytes('KEEPALIVE');45 % content = []; % no payload in NXT command KEEPALIVE46 % packet = COM_CreatePacket(type, cmd, 'reply', content);47 % 48 % COM_SendPacket(packet, handle);49 % 50 % [type cmd statusbyte content] = COM_CollectPacket(handle);51 % % Now you could check the statusbyte or interpret the content.52 % % Or maybe check for valid type and cmd before...40 %+ COM_MakeBTConfigFile(); 41 %+ 42 %+ handle = COM_OpenNXT('bluetooth.ini', 'check'); 43 %+ 44 %+ [type cmd] = name2commandbytes('KEEPALIVE'); 45 %+ content = []; % no payload in NXT command KEEPALIVE 46 %+ packet = COM_CreatePacket(type, cmd, 'reply', content); 47 %+ 48 %+ COM_SendPacket(packet, handle); 49 %+ 50 %+ [type cmd statusbyte content] = COM_CollectPacket(handle); 51 %+ % Now you could check the statusbyte or interpret the content. 52 %+ % Or maybe check for valid type and cmd before... 53 53 % 54 54 % See also: COM_CreatePacket, COM_SendPacket, COM_OpenNXT, COM_GetDefaultNXT, … … 60 60 % Copyright: 2007-2008, RWTH Aachen University 61 61 % 62 ; 62 63 % 63 64 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_CreatePacket.m
r201 r282 3 3 % 4 4 % Syntax 5 % bytes = COM_CreatePacket(CommandType, Command, ReplyMode, ContentBytes)5 % |bytes = COM_CreatePacket(CommandType, Command, ReplyMode, ContentBytes)| 6 6 % 7 7 % Description 8 % bytes = COM_CreatePacket(CommandType, Command, ReplyMode, ContentBytes)creates a valid9 % Bluetooth packet conform to the LEGO Mindstorms communication protocol. The CommandType8 % |bytes = COM_CreatePacket(CommandType, Command, ReplyMode, ContentBytes)| creates a valid 9 % Bluetooth packet conform to the LEGO Mindstorms communication protocol. The |CommandType| 10 10 % specifies the telegram type (direct or system command (see the 11 11 % LEGO Mindstorms communication protocol documentation for more details)). This type is determined 12 % from the function name2commandbytes. The Commandspecifies the actual command according to13 % the LEGO Mindstorms communication protocol. By the ReplyModeone can request an14 % acknowledgement for the packet transmission. The two strings 'reply' and 'dontreply'are15 % valid. The content byte-array is given by the ContentBytes.12 % from the function |name2commandbytes|. The |Command| specifies the actual command according to 13 % the LEGO Mindstorms communication protocol. By the |ReplyMode| one can request an 14 % acknowledgement for the packet transmission. The two strings |'reply'| and |'dontreply'| are 15 % valid. The content byte-array is given by the |ContentBytes|. 16 16 % 17 % The return value bytesrepresents the complete Bluetooth packet conform to the LEGO Mindstorms17 % The return value |bytes| represents the complete Bluetooth packet conform to the LEGO Mindstorms 18 18 % Communication protocol. 19 19 % 20 20 % Note: 21 % The activated ReplyModeshould only be used if it is necessary. According to the official21 % The activated |ReplyMode| should only be used if it is necessary. According to the official 22 22 % LEGO statement "Testing during development has shown that the Bluetooth Serial Port 23 23 % communication has some disadvantages when it comes to streaming data. ... One problem is a time … … 29 29 % 30 30 % Example 31 % [type cmd] = name2commandbytes('PLAYTONE');32 % content(1:2) = dec2wordbytes(frequency, 2);33 % content(3:4) = dec2wordbytes(duration, 2);34 % 35 % packet = COM_CreatePacket(type, cmd, 'dontreply', content);31 %+ [type cmd] = name2commandbytes('PLAYTONE'); 32 %+ content(1:2) = dec2wordbytes(frequency, 2); 33 %+ content(3:4) = dec2wordbytes(duration, 2); 34 %+ 35 %+ packet = COM_CreatePacket(type, cmd, 'dontreply', content); 36 36 % 37 37 % See also: COM_SendPacket, COM_CollectPacket, name2commandbytes, dec2wordbytes … … 42 42 % Copyright: 2007-2008, RWTH Aachen University 43 43 % 44 ; 44 45 % 45 46 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_GetDefaultNXT.m
r201 r282 3 3 % 4 4 % Syntax 5 % h = COM_GetDefaultNXT()5 % |h = COM_GetDefaultNXT()| 6 6 % 7 7 % Description 8 % h = COM_GetDefaultNXT() returns the global default NXT handle hif it was previously8 % |h = COM_GetDefaultNXT()| returns the global default NXT handle |h| if it was previously 9 9 % set. The default global NXT handle is used by all NXT-Functions per default if no other 10 % handle is specified. To set this global handle the function COM_SetDefaultNXTis used.10 % handle is specified. To set this global handle the function |COM_SetDefaultNXT| is used. 11 11 % 12 12 % Example 13 % handle = COM_OpenNXT('bluetooth.ini', 'check');14 % COM_SetDefaultNXT(handle);15 % MyNXT = COM_GetDefaultNXT();16 % % now MyNXT and handle refer to the same device13 %+ handle = COM_OpenNXT('bluetooth.ini', 'check'); 14 %+ COM_SetDefaultNXT(handle); 15 %+ MyNXT = COM_GetDefaultNXT(); 16 %+ % now MyNXT and handle refer to the same device 17 17 % 18 18 % See also: COM_SetDefaultNXT, COM_OpenNXT, COM_OpenNXTEx … … 23 23 % Copyright: 2007-2008, RWTH Aachen University 24 24 % 25 ; 25 26 % 26 27 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_MakeBTConfigFile.m
r201 r282 3 3 % 4 4 % Syntax 5 % COM_MakeBTConfigFile()5 % |COM_MakeBTConfigFile()| 6 6 % 7 7 % Description 8 % COM_MakeBTConfigFile()starts a user guided dialog window to select the output directory,8 % |COM_MakeBTConfigFile()| starts a user guided dialog window to select the output directory, 9 9 % the file name and the Bluetooth paramters like e.g. COM port. 10 10 % 11 11 % The little program creates a specific Bluetooth configuration file for the current PC system. 12 12 % Make sure the configuration file is accessible under MATLAB if you try to open a Bluetooth 13 % connection using COM_OpenNXTand the correct file name.13 % connection using |COM_OpenNXT| and the correct file name. 14 14 % 15 15 % Example 16 % COM_MakeBTConfigFile();17 % 18 % handle = COM_OpenNXT('bluetooth.ini', 'check');16 %+ COM_MakeBTConfigFile(); 17 %+ 18 %+ handle = COM_OpenNXT('bluetooth.ini', 'check'); 19 19 % 20 20 % See also: COM_OpenNXT, COM_CloseNXT, COM_OpenNXTEx … … 25 25 % Copyright: 2007-2008, RWTH Aachen University 26 26 % 27 ; 27 28 % 28 29 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_OpenNXT.m
r201 r282 3 3 % 4 4 % Syntax 5 % handle = COM_OpenNXT()5 % |handle = COM_OpenNXT()| 6 6 % 7 % handle = COM_OpenNXT(inifilename, 'check')7 % |handle = COM_OpenNXT(inifilename, 'check')| 8 8 % 9 9 % Description 10 % handle = COM_OpenNXT()tries to open a connection via USB. The first10 % |handle = COM_OpenNXT()| tries to open a connection via USB. The first 11 11 % NXT device that is found will be used. Device drivers (Fantom on 12 12 % Windows, libusb on Linux) have to be already installed for USB to work. 13 13 % 14 % handle = COM_OpenNXT(inifilename, 'check')will search the USB bus14 % |handle = COM_OpenNXT(inifilename, 'check')| will search the USB bus 15 15 % for NXT devices, just as the syntax without any parameters. If this fails 16 16 % for some reason (no USB connection to the NXT available, no device drivers 17 17 % installed, or NXT device is busy), the function will try to establish a 18 18 % connection via Bluetooth, using the given Bluetooth configuration file 19 % (you can create one easily with COM_MakeBTConfigFile. The optional20 % paramter 'check'can be omitted, but that is not recommended (as it detects errors with the19 % (you can create one easily with |COM_MakeBTConfigFile|. The optional 20 % paramter |'check'| can be omitted, but that is not recommended (as it detects errors with the 21 21 % Bluetooth connection outside MATLAB right away). For more information 22 % about this 'check'-option, see the documentation on NXT_CloseNXTEx.22 % about this |'check'|-option, see the documentation on |NXT_CloseNXTEx|. 23 23 % 24 24 % 25 25 % Note that this function is the most simple way to get an NXT handle. If 26 26 % you need a method to access multiple NXTs or more options, see the 27 % advanced function COM_OpenNXTEx. In fact, COM_OpenNXTis just a28 % convenient wrapper to COM_OpenNXTEx('Any', ...).27 % advanced function |COM_OpenNXTEx|. In fact, |COM_OpenNXT| is just a 28 % convenient wrapper to |COM_OpenNXTEx('Any', ...)|. 29 29 % 30 30 % 31 % Limitations of COM_CloseNXT32 % If you call COM_CloseNXT('all') after a clear allcommand has been31 % Limitations of |COM_CloseNXT| 32 % If you call |COM_CloseNXT('all')| after a |clear all| command has been 33 33 % issued, the function will not be able to close all remaining open USB 34 34 % handles, since they have been cleared out of memory. This is a problem 35 35 % on Linux systems. You will not be able to use the NXT device without 36 36 % rebooting it. 37 % Solution: Either use only clearin your programs, or you use the38 % COM_CloseNXT('all') statement before clear all.37 % Solution: Either use only |clear| in your programs, or you use the 38 % |COM_CloseNXT('all')| statement before |clear all|. 39 39 % The best way however is to track your handles carefully and close them 40 % manually ( COM_CloseNXT(handle)) before exiting whenever possible!40 % manually (|COM_CloseNXT(handle)|) before exiting whenever possible! 41 41 % 42 42 % 43 43 % Example 44 % handle = COM_OpenNXT('bluetooth.ini',check');45 % COM_SetDefaultNXT(handle);46 % NXT_PlayTone(440,10);47 % COM_CloseNXT(handle);44 %+ handle = COM_OpenNXT('bluetooth.ini', 'check'); 45 %+ COM_SetDefaultNXT(handle); 46 %+ NXT_PlayTone(440,10); 47 %+ COM_CloseNXT(handle); 48 48 % 49 49 % See also: COM_OpenNXTEx, COM_CloseNXT, COM_MakeBTConfigFile, COM_SetDefaultNXT … … 54 54 % Copyright: 2007-2008, RWTH Aachen University 55 55 % 56 ; 56 57 % 57 58 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_OpenNXTEx.m
r247 r282 245 245 % handle.IniFilename = h.IniFilename; 246 246 % handle.ComPort = h.ComPort; 247 % handle.BaudRate = h.BaudRate;248 % handle.DataBits = h.DataBits;249 % handle.Timeout = h.Timeout;247 % handle.BaudRate = h.BaudRate; 248 % handle.DataBits = h.DataBits; 249 % handle.Timeout = h.Timeout; 250 250 % 251 % handle.SendSendPause = h.SendSendPause;251 % handle.SendSendPause = h.SendSendPause; 252 252 % handle.SendReceivePause = h.SendReceivePause; 253 253 % 254 254 % handle.NXTMAC = h.NXTMAC; 255 % handle.CreationTime = h.CreationTime;255 % handle.CreationTime = h.CreationTime; 256 256 % handle.Index = h.Index; 257 257 -
branches/telle/RWTHMindstormsNXT-Lejos/COM_SendPacket.m
r281 r282 3 3 % 4 4 % Syntax 5 % COM_SendPacket(Packet, handle)5 % |COM_SendPacket(Packet, handle)| 6 6 % 7 7 % Description 8 % COM_SendPacket(Packet, handle) sends the given byte-array Packet(column vector),9 % (which can easily be created by the function COM_CreatePacket) over the USB or Bluetooth10 % channel specified by the given handle (struct) created by the function COM_OpenNXTor11 % COM_OpenNXTEx, or obtained from COM_GetDefaultNXT.8 % |COM_SendPacket(Packet, handle)| sends the given byte-array |Packet| (column vector), 9 % (which can easily be created by the function |COM_CreatePacket|) over the USB or Bluetooth 10 % channel specified by the given |handle| (struct) created by the function |COM_OpenNXT| or 11 % |COM_OpenNXTEx|, or obtained from |COM_GetDefaultNXT|. 12 12 % 13 13 % Note 14 14 % In the case of a Bluetooth connection this function uses the specific settings from the 15 15 % ini-file that was specified when opening the handle. Parameters used here are 16 % SendSendPause and SendReceivePause, which will cause this function to wait a certain16 % |SendSendPause| and |SendReceivePause|, which will cause this function to wait a certain 17 17 % amount of milliseconds between each consecutive send or receive operation to avoid packet 18 18 % loss or buffer overflows inside the blutooth stack. 19 19 % 20 20 % Example 21 % COM_MakeBTConfigFile();22 % 23 % handle = COM_OpenNXT('bluetooth.ini', 'check');24 % 25 % [type cmd] = name2commandbytes('KEEPALIVE');26 % content = []; % no payload in NXT command KEEPALIVE27 % packet = COM_CreatePacket(type, cmd, 'dontreply', content);28 % 29 % COM_SendPacket(packet, bt_handle);21 %+ COM_MakeBTConfigFile(); 22 %+ 23 %+ handle = COM_OpenNXT('bluetooth.ini', 'check'); 24 %+ 25 %+ [type cmd] = name2commandbytes('KEEPALIVE'); 26 %+ content = []; % no payload in NXT command KEEPALIVE 27 %+ packet = COM_CreatePacket(type, cmd, 'dontreply', content); 28 %+ 29 %+ COM_SendPacket(packet, bt_handle); 30 30 % 31 31 % See also: COM_CreatePacket, COM_CollectPacket, COM_OpenNXT, COM_GetDefaultNXT, COM_MakeBTConfigFile … … 36 36 % Copyright: 2007-2008, RWTH Aachen University 37 37 % 38 ; 38 39 % 39 40 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/COM_SetDefaultNXT.m
r201 r282 3 3 % 4 4 % Syntax 5 % COM_SetDefaultNXT(h)5 % |COM_SetDefaultNXT(h)| 6 6 % 7 7 % Description 8 % COM_SetDefaultNXT(h) sets the given handle hto the global NXT handle, which is used8 % |COM_SetDefaultNXT(h)| sets the given handle |h| to the global NXT handle, which is used 9 9 % by all NXT-Functions per default if no other handle is specified. To 10 10 % create and open an NXT handle (Bluetooth or USB), the functions 11 % COM_OpenNXT and COM_OpenNXTExcan be used. To retrieve the global default handle12 % user COM_GetDefaultNXT.11 % |COM_OpenNXT| and |COM_OpenNXTEx| can be used. To retrieve the global default handle 12 % user |COM_GetDefaultNXT|. 13 13 % 14 14 % Example 15 % MyNXT = COM_OpenNXT('bluetooth.ini', 'check');16 % COM_SetDefaultNXT(MyNXT);15 %+ MyNXT = COM_OpenNXT('bluetooth.ini', 'check'); 16 %+ COM_SetDefaultNXT(MyNXT); 17 17 % 18 18 % See also: COM_GetDefaultNXT, COM_OpenNXT, COM_OpenNXTEx … … 23 23 % Copyright: 2007-2008, RWTH Aachen University 24 24 % 25 ; 25 26 % 26 27 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/CloseSensor.m
r201 r282 3 3 % 4 4 % Syntax 5 % CloseSensor(port)5 % |CloseSensor(port)| 6 6 % 7 7 % Description 8 % CloseSensor(port) closes the sensor port opened by the Open... functions. The value portcan be9 % addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to8 % |CloseSensor(port)| closes the sensor |port| opened by the |Open...| functions. The value |port| can be 9 % addressed by the symbolic constants |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to 10 10 % the labeling on the NXT Brick. Closing the light sensor deactives the active light 11 11 % mode (the red light is turned off), closing the Ultrasonic sensor stops sending out ultrasound. … … 13 13 % 14 14 % Examples 15 % OpenLight(SENSOR_3, 'ACTIVE');16 % light = GetLight(SENSOR_3);17 % CloseSensor(SENSOR_3);15 %+ OpenLight(SENSOR_3, 'ACTIVE'); 16 %+ light = GetLight(SENSOR_3); 17 %+ CloseSensor(SENSOR_3); 18 18 % 19 19 % See also: NXT_SetInputMode, OpenLight, OpenSound, OpenSwitch, OpenUltrasonic, SENSOR_1, SENSOR_2, … … 25 25 % Copyright: 2007-2008, RWTH Aachen University 26 26 % 27 ; 27 28 % 28 29 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/DebugMode.m
r201 r282 3 3 % 4 4 % Syntax 5 % state = DebugMode();5 % |state = DebugMode();| 6 6 % 7 % DebugMode(state);7 % |DebugMode(state);| 8 8 % 9 9 % 10 10 % Description 11 % The function textOutcan be used to display text messages inside the command11 % The function |textOut| can be used to display text messages inside the command 12 12 % window. These messages can optionally be logged to a file (see textOut for 13 13 % details) or the output can be disable. To turn off those debug messages, the 14 % global variable DisableScreenOuthad to be modified in earlier toolbox15 % versions. Now the function DebugModeprovides easier access.14 % global variable |DisableScreenOut| had to be modified in earlier toolbox 15 % versions. Now the function |DebugMode| provides easier access. 16 16 % 17 % state = DebugMode();returns the current debug state, the return value is18 % either 'on' or 'off'.17 % |state = DebugMode();| returns the current debug state, the return value is 18 % either |'on'| or |'off'|. 19 19 % 20 % DebugMode(state);is used to switch between displaying messages and silent21 % mode. The paramter state has to be 'on' or 'off'.20 % |DebugMode(state);| is used to switch between displaying messages and silent 21 % mode. The paramter |state| has to be |'on'| or |'off'|. 22 22 % 23 23 % 24 % Note: If you need a fast alternative to strcmpi(DebugMode(), 'on'), please25 % consider the private toolbox function isdebug.24 % Note: If you need a fast alternative to |strcmpi(DebugMode(), 'on')|, please 25 % consider the private toolbox function |isdebug|. 26 26 % 27 27 % Example 28 % % enable debug messages29 % DebugMode on28 %+ % enable debug messages 29 %+ DebugMode on 30 30 % 31 % % remember old setting32 % oldState = DebugMode();33 % DebugMode('on');34 % % do something with textOut(), it will be displayed!35 % % restore previous setting36 % DebugMode(oldState);31 %+ % remember old setting 32 %+ oldState = DebugMode(); 33 %+ DebugMode('on'); 34 %+ % do something with textOut(), it will be displayed! 35 %+ % restore previous setting 36 %+ DebugMode(oldState); 37 37 % 38 38 % … … 44 44 % Copyright: 2007-2008, RWTH Aachen University 45 45 % 46 ; 46 47 % 47 48 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetLight.m
r201 r282 3 3 % 4 4 % Syntax 5 % light = GetLight(port)5 % |light = GetLight(port)| 6 6 % 7 7 % Description 8 % light = GetLight(port) returns the current light value lightof the NXT light9 % sensor. The measurement value lightrepresents the normalized (default) sound value (0..1023 /10 % 10 Bit). The normalized value mode is set per default by the function OpenLight.11 % The given port number specifies the connection port. The value portcan be12 % addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to8 % |light = GetLight(port)| returns the current light value |light| of the NXT light 9 % sensor. The measurement value |light| represents the normalized (default) sound value (0..1023 / 10 % 10 Bit). The normalized value mode is set per default by the function |OpenLight|. 11 % The given |port| number specifies the connection port. The value |port| can be 12 % addressed by the symbolic constants |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to 13 13 % the labeling on the NXT Brick. 14 14 % 15 % For more complex settings the function NXT_GetInputValuescan be used.15 % For more complex settings the function |NXT_GetInputValues| can be used. 16 16 % 17 17 % Examples 18 % OpenLight(SENSOR_1, 'ACTIVE');19 % light = GetLight(SENSOR_1);20 % CloseSensor(SENSOR_1);18 %+ OpenLight(SENSOR_1, 'ACTIVE'); 19 %+ light = GetLight(SENSOR_1); 20 %+ CloseSensor(SENSOR_1); 21 21 % 22 22 % See also: NXT_GetInputValues, OpenLight, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetMemoryCount.m
r201 r282 3 3 % 4 4 % Syntax 5 % memory = GetMemoryCount(port)5 % |memory = GetMemoryCount(port)| 6 6 % 7 7 % Description 8 % memory = GetMemoryCount(port)gets the internal NXT memory counter (maual mapping replica)9 % of the given motor port. The value portcan be addressed by the symbolic constants10 % MOTOR_A, MOTOR_B and MOTOR_Canalog to the labeling on the NXT Brick. The return value11 % memorycontains the value of the NXT memory counter (maunal mapping replica).8 % |memory = GetMemoryCount(port)| gets the internal NXT memory counter (maual mapping replica) 9 % of the given motor |port|. The value |port| can be addressed by the symbolic constants 10 % |MOTOR_A|, |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT Brick. The return value 11 % |memory| contains the value of the NXT memory counter (maunal mapping replica). 12 12 % 13 13 % Note: … … 15 15 % 16 16 % Examples 17 % memory = GetMemoryCount(MOTOR_A);17 %+ memory = GetMemoryCount(MOTOR_A); 18 18 % 19 19 % See also: SetMemoryCounter, MOTOR_A, MOTOR_B, MOTOR_C … … 24 24 % Copyright: 2007-2008, RWTH Aachen University 25 25 % 26 ; 26 27 % 27 28 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetMotor.m
r201 r282 3 3 % 4 4 % Syntax 5 % number = GetMotor()5 % |number = GetMotor()| 6 6 % 7 7 % Description 8 % number = GetMotor() returns the current motor number set by function SetMotor. The value9 % number can be 0, 1 or 2.8 % |number = GetMotor()| returns the current motor |number| set by function |SetMotor|. The value 9 % |number| can be |0|, |1| or |2|. 10 10 % 11 11 % Example 12 % SetMotor(MOTOR_B);13 % number = GetMotor();12 %+ SetMotor(MOTOR_B); 13 %+ number = GetMotor(); 14 14 % 15 15 % See also: SetMotor … … 20 20 % Copyright: 2007-2008, RWTH Aachen University 21 21 % 22 ; 22 23 % 23 24 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetMotorSettings.m
r248 r282 3 3 % 4 4 % Syntax 5 % data = GetMotorSettings(port)5 % |data = GetMotorSettings(port)| 6 6 % 7 7 % Description 8 % data = GetMotorSettings(port)returns the current motor data / settings of the given motor9 % port. The value port can be addressed by the symbolic constants MOTOR_A , MOTOR_Band10 % MOTOR_C analog to the labeling on the NXT Brick. The return value datais a struct variable.8 % |data = GetMotorSettings(port)| returns the current motor data / settings of the given motor 9 % |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A| , |MOTOR_B| and 10 % |MOTOR_C| analog to the labeling on the NXT Brick. The return value |data| is a struct variable. 11 11 % It contains several motor settings and information. 12 12 % 13 13 % Output: 14 % data.IsRunning% boolean, true if the motor "does something"14 % |data.IsRunning| % boolean, true if the motor "does something" 15 15 % 16 % data.Power% current power16 % |data.Power| % current power 17 17 % 18 % data.AngleLimit% current set angle limit, 0 means none set18 % |data.AngleLimit| % current set angle limit, 0 means none set 19 19 % 20 % data.TurnRatio% current turn ratio20 % |data.TurnRatio| % current turn ratio 21 21 % 22 % data.SpeedRegulation% boolean, speed regulated or not?22 % |data.SpeedRegulation| % boolean, speed regulated or not? 23 23 % 24 % data.SyncToMotor% the motor this one is synced to. -1 means not synced24 % |data.SyncToMotor| % the motor this one is synced to. -1 means not synced 25 25 % 26 % data.TachoCount% internal, non-resettable rotation-counter (in degrees)26 % |data.TachoCount| % internal, non-resettable rotation-counter (in degrees) 27 27 % 28 % data.Angle % current motor position, resettable using, ResetMotorAngle28 % |data.Angle| % current motor position, resettable using, |ResetMotorAngle| 29 29 % 30 % data.MotorBrake% boolean, is electronic braking enabled?30 % |data.MotorBrake| % boolean, is electronic braking enabled? 31 31 % 32 32 % Example 33 % SetMotor(MOTOR_C);34 % SetPower(67);35 % SetAngleLimit(240);36 % SpeedRegulation('on');37 % SendMotorSettings();38 % 39 % WaitForMotor(MOTOR_C);40 % 41 % data = GetMotorSettings(MOTOR_C);33 %+ SetMotor(MOTOR_C); 34 %+ SetPower(67); 35 %+ SetAngleLimit(240); 36 %+ SpeedRegulation('on'); 37 %+ SendMotorSettings(); 38 %+ 39 %+ WaitForMotor(MOTOR_C); 40 %+ 41 %+ data = GetMotorSettings(MOTOR_C); 42 42 % 43 43 % See also: SendMotorSettings, ResetMotorAngle … … 48 48 % Copyright: 2007-2008, RWTH Aachen University 49 49 % 50 ; 50 51 % 51 52 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetSound.m
r201 r282 3 3 % 4 4 % Syntax 5 % sound = GetSound(port)5 % |sound = GetSound(port)| 6 6 % 7 7 % Description 8 % sound = GetSound(port) returns the current sound value soundof the NXT sound9 % sensor. The measurement value soundrepresents the normalized (default) sound value (0..1023 /10 % 10 Bit). The normalized value mode is set per default by the function OpenSound.11 % The given port number specifies the connection port. The value portcan be12 % addressed by the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to8 % |sound = GetSound(port)| returns the current sound value |sound| of the NXT sound 9 % sensor. The measurement value |sound| represents the normalized (default) sound value (0..1023 / 10 % 10 Bit). The normalized value mode is set per default by the function |OpenSound|. 11 % The given |port| number specifies the connection port. The value |port| can be 12 % addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to 13 13 % the labeling on the NXT Brick. 14 14 % 15 % For more complex settings the function NXT_GetInputModecan be used.15 % For more complex settings the function |NXT_GetInputMode| can be used. 16 16 % 17 17 % Example 18 % OpenSound(SENSOR_1, 'DB');19 % sound = GetSound(SENSOR_1);20 % CloseSensor(SENSOR_1);18 %+ OpenSound(SENSOR_1, 'DB'); 19 %+ sound = GetSound(SENSOR_1); 20 %+ CloseSensor(SENSOR_1); 21 21 % 22 22 % See also: NXT_GetInputMode, OpenLight, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetSwitch.m
r201 r282 3 3 % 4 4 % Syntax 5 % switch = GetSwitch(port)5 % |switch = GetSwitch(port)| 6 6 % 7 7 % Description 8 % switch = GetSwitch(port) returns the current switch value switchof the NXT switch / touch9 % sensor. The measurement value switchrepresents the pressing mode of the switch / touch10 % sensor. true is returned if the switch / touch sensor is being pressed and falseif it is11 % being released. The given port number specifies the connection port. The value portcan be12 % addressed by the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to8 % |switch = GetSwitch(port)| returns the current switch value |switch| of the NXT switch / touch 9 % sensor. The measurement value |switch| represents the pressing mode of the switch / touch 10 % sensor. |true| is returned if the switch / touch sensor is being pressed and |false| if it is 11 % being released. The given |port| number specifies the connection port. The value |port| can be 12 % addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to 13 13 % the labeling on the NXT Brick. 14 14 % 15 % For more complex settings the function NXT_GetInputValuescan be used.15 % For more complex settings the function |NXT_GetInputValues| can be used. 16 16 % 17 17 % Example 18 % OpenSwitch(SENSOR_4);19 % switchState = GetSwitch(SENSOR_4);20 % CloseSensor(SENSOR_4);18 %+ OpenSwitch(SENSOR_4); 19 %+ switchState = GetSwitch(SENSOR_4); 20 %+ CloseSensor(SENSOR_4); 21 21 % 22 22 % See also: NXT_GetInputValues, OpenSwitch, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/GetUltrasonic.m
r201 r282 3 3 % 4 4 % Syntax 5 % distance = GetUltrasonic(port)5 % |distance = GetUltrasonic(port)| 6 6 % 7 7 % Description 8 % distance = GetUltraSonic(port) returns the current measurement value distanceof the NXT9 % ultrasonic sensor. distancerepresents the measured distance in cm.10 % The given port number specifies the connection port. The value portcan be11 % addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to8 % |distance = GetUltraSonic(port)| returns the current measurement value |distance| of the NXT 9 % ultrasonic sensor. |distance| represents the measured distance in cm. 10 % The given |port| number specifies the connection port. The value |port| can be 11 % addressed by the symbolic constants |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to 12 12 % the labeling on the NXT Brick. 13 13 % 14 % For more complex settings the functions NXT_LSRead and NXT_LSWritecan be used.14 % For more complex settings the functions |NXT_LSRead| and |NXT_LSWrite| can be used. 15 15 % 16 16 % Example 17 % OpenUltrasonic(SENSOR_4);18 % distance = GetUltrasonic(SENSOR_4);19 % CloseSensor(SENSOR_4);17 %+ OpenUltrasonic(SENSOR_4); 18 %+ distance = GetUltrasonic(SENSOR_4); 19 %+ CloseSensor(SENSOR_4); 20 20 % 21 21 % See also: OpenUltrasonic, USMakeSnapshot, USGetSnapshotResults, CloseSensor, NXT_LSRead, NXT_LSWrite … … 26 26 % Copyright: 2007-2008, RWTH Aachen University 27 27 % 28 ; 28 29 % 29 30 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_GetCommModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % map = MAP_GetCommModule()5 % |map = MAP_GetCommModule()| 6 6 % 7 7 % Description 8 % map = MAP_GetCommModule()returns the IO map of the communication module. The return9 % value mapis a struct variable. It contains all communication module information.8 % |map = MAP_GetCommModule()| returns the IO map of the communication module. The return 9 % value |map| is a struct variable. It contains all communication module information. 10 10 % 11 11 % Output: 12 % map.PFunc% ?13 % 14 % map.PFuncTwo% ?15 % 16 % map.BTPort% 1x4 cell array contains Bluetooth device information of each12 % |map.PFunc| % ? 13 % 14 % |map.PFuncTwo| % ? 15 % 16 % |map.BTPort| % 1x4 cell array contains Bluetooth device information of each 17 17 % NXT Bluetooth port (i = 0..3) 18 18 % 19 % map.BTPort{i}.BtDeviceTableName% name of the Bluetooth device20 % 21 % map.BTPort{i}.BtDeviceTableClassOfDevice% class of the Bluetooth device22 % 23 % map.BTPort{i}.BtDeviceTableBdAddr% MAC address of the Bluetooth device24 % 25 % map.BTPort{i}.BtDeviceTableDeviceStatus% status of the Bluetooth device26 % 27 % map.BTPort{i}.BtConnectTableName% name of the connected Bluetooth device28 % 29 % map.BTPort{i}.BtConnectTableClassOfDevice% class of the connected Bluetooth device30 % 31 % map.BTPort{i}.BtConnectTablePinCode% pin code of the connected Bluetooth device32 % 33 % map.BTPort{i}.BtConnetTableBdAddr% MAC address of the connected Bluetooth device34 % 35 % map.BTPort{i}.BtConnectTableHandleNr% handle nr of the connected Bluetooth device36 % 37 % map.BTPort{i}.BtConnectTableStreamStatus% stream status of the connected Bluetooth device38 % 39 % map.BTPort{i}.BtConnectTableLinkQuality% link quality of the connected Bluetooth device40 % 41 % map.BrickDataName% name of the NXT brick42 % 43 % map.BrickDataBluecoreVersion% Bluecore version number44 % 45 % map.BrickDataBdAddr% MAC address of the NXT brick46 % 47 % map.BrickDataBtStateStatus% Bluetooth state status48 % 49 % map.BrickDataBtHwStatus% NXT hardware status50 % 51 % map.BrickDataTimeOutValue% time out value52 % 53 % map.BtDeviceCnt% number of devices defined within the Bluetooth device table54 % 55 % map.BtDeviceNameCnt% number of devices defined within the Bluetooth device table19 % |map.BTPort{i}.BtDeviceTableName| % name of the Bluetooth device 20 % 21 % |map.BTPort{i}.BtDeviceTableClassOfDevice| % class of the Bluetooth device 22 % 23 % |map.BTPort{i}.BtDeviceTableBdAddr| % MAC address of the Bluetooth device 24 % 25 % |map.BTPort{i}.BtDeviceTableDeviceStatus| % status of the Bluetooth device 26 % 27 % |map.BTPort{i}.BtConnectTableName| % name of the connected Bluetooth device 28 % 29 % |map.BTPort{i}.BtConnectTableClassOfDevice| % class of the connected Bluetooth device 30 % 31 % |map.BTPort{i}.BtConnectTablePinCode| % pin code of the connected Bluetooth device 32 % 33 % |map.BTPort{i}.BtConnetTableBdAddr| % MAC address of the connected Bluetooth device 34 % 35 % |map.BTPort{i}.BtConnectTableHandleNr| % handle nr of the connected Bluetooth device 36 % 37 % |map.BTPort{i}.BtConnectTableStreamStatus| % stream status of the connected Bluetooth device 38 % 39 % |map.BTPort{i}.BtConnectTableLinkQuality| % link quality of the connected Bluetooth device 40 % 41 % |map.BrickDataName| % name of the NXT brick 42 % 43 % |map.BrickDataBluecoreVersion| % Bluecore version number 44 % 45 % |map.BrickDataBdAddr| % MAC address of the NXT brick 46 % 47 % |map.BrickDataBtStateStatus| % Bluetooth state status 48 % 49 % |map.BrickDataBtHwStatus| % NXT hardware status 50 % 51 % |map.BrickDataTimeOutValue| % time out value 52 % 53 % |map.BtDeviceCnt| % number of devices defined within the Bluetooth device table 54 % 55 % |map.BtDeviceNameCnt| % number of devices defined within the Bluetooth device table 56 56 % (usually equal to BtDeviceCnt) 57 57 % 58 % map.HsFlags% High Speed flags59 % 60 % map.HsSpeed% High Speed speed61 % 62 % map.HsState% High Speed state63 % 64 % map.HsSpeed% High Speed speed65 % 66 % map.UsbState% USB state58 % |map.HsFlags| % High Speed flags 59 % 60 % |map.HsSpeed| % High Speed speed 61 % 62 % |map.HsState| % High Speed state 63 % 64 % |map.HsSpeed| % High Speed speed 65 % 66 % |map.UsbState| % USB state 67 67 % 68 68 % Examples 69 % map = MAP_GetCommModule();69 %+ map = MAP_GetCommModule(); 70 70 % 71 71 % See also: NXT_ReadIOMap … … 76 76 % Copyright: 2007-2008, RWTH Aachen University 77 77 % 78 ; 78 79 % 79 80 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_GetInputModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % map = MAP_GetInputModule(port)5 % |map = MAP_GetInputModule(port)| 6 6 % 7 7 % Description 8 % map = MAP_GetInputModule(port)returns the IO map of the input module at the given sensor9 % port. The sensor port can be addressed by SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_410 % and 'all'. The return value map is a struct variable or cell array ('all'mode).8 % |map = MAP_GetInputModule(port)| returns the IO map of the input module at the given sensor 9 % |port|. The sensor |port| can be addressed by |SENSOR_1|, |SENSOR_2|, |SENSOR_3|, |SENSOR_4| 10 % and |'all'|. The return value |map| is a struct variable or cell array (|'all'| mode). 11 11 % It contains all input module information. 12 12 % 13 13 % Output: 14 % map.CustomZeroOffset% custom sensor zero offset value of a sensor.14 % |map.CustomZeroOffset| % custom sensor zero offset value of a sensor. 15 15 % 16 % map.ADRaw% raw 10-bit value last read from the ananlog to digital converter. Raw16 % |map.ADRaw| % raw 10-bit value last read from the ananlog to digital converter. Raw 17 17 % values produced by sensors typically cover some subset of the 18 18 % full 10-bit range. 19 19 % 20 % map.SensorRaw% raw sensor value20 % |map.SensorRaw| % raw sensor value 21 21 % 22 % map.SensorValue% tacho/angle limit, 0 means none set22 % |map.SensorValue| % tacho/angle limit, 0 means none set 23 23 % 24 % map.SensorType% sensor value24 % |map.SensorType| % sensor value 25 25 % 26 % map.SensorMode% sensor mode26 % |map.SensorMode| % sensor mode 27 27 % 28 % map.SensorBoolean% boolean sensor value28 % |map.SensorBoolean| % boolean sensor value 29 29 % 30 % map.DigiPinsDir% digital pins direction value of a sensor30 % |map.DigiPinsDir| % digital pins direction value of a sensor 31 31 % 32 % map.DigiPinsIn% digital pins status value of a sensor ?32 % |map.DigiPinsIn| % digital pins status value of a sensor ? 33 33 % 34 % map.DigiPinsOut% digital pins output level value of a sensor34 % |map.DigiPinsOut| % digital pins output level value of a sensor 35 35 % 36 % map.CustomPctFullScale% custom sensor percent full scale value of the sensor.36 % |map.CustomPctFullScale| % custom sensor percent full scale value of the sensor. 37 37 % 38 % map.CustomActiveStatus% custom sensor active status value of the sensor38 % |map.CustomActiveStatus| % custom sensor active status value of the sensor 39 39 % 40 % map.InvalidData% value of the InvalidData flag of the sensor40 % |map.InvalidData| % value of the InvalidData flag of the sensor 41 41 % 42 42 % 43 43 % Examples 44 % map = MAP_GetInputModule(SENSOR_2);44 %+ map = MAP_GetInputModule(SENSOR_2); 45 45 % 46 % map = MAP_GetInputModule('all');46 %+ map = MAP_GetInputModule('all'); 47 47 % 48 48 % See also: NXT_ReadIOMap … … 53 53 % Copyright: 2007-2008, RWTH Aachen University 54 54 % 55 ; 55 56 % 56 57 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_GetOutputModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % map = MAP_GetOutputModule(motor)5 % |map = MAP_GetOutputModule(motor)| 6 6 % 7 7 % Description 8 % map = MAP_GetOutputModule(motor)returns the IO map of the output module at the given9 % motor port. The motor port can be addressed by MOTOR_A, MOTOR_B, MOTOR_C and 'all'.10 % The return value map is a struct variable or cell array ('all'mode). It contains all8 % |map = MAP_GetOutputModule(motor)| returns the IO map of the output module at the given 9 % |motor| port. The |motor| port can be addressed by |MOTOR_A|, |MOTOR_B|, |MOTOR_C| and |'all'|. 10 % The return value |map| is a struct variable or cell array (|'all'| mode). It contains all 11 11 % output module information. 12 12 % 13 13 % Output: 14 % map.TachoCount% internal, non-resettable rotation-counter (in degrees)14 % |map.TachoCount| % internal, non-resettable rotation-counter (in degrees) 15 15 % 16 % map.BlockTachoCount% block tacho counter, current motor position, resettable using,16 % |map.BlockTachoCount| % block tacho counter, current motor position, resettable using, 17 17 % ResetMotorAngle (NXT-G counter since block start) 18 18 % 19 % map.RotationCount% rotation tacho counter, current motor position (NXT-G counter19 % |map.RotationCount| % rotation tacho counter, current motor position (NXT-G counter 20 20 % since program start) 21 21 % 22 % map.TachoLimit% tacho/angle limit, 0 means none set22 % |map.TachoLimit| % tacho/angle limit, 0 means none set 23 23 % 24 % map.MotorRPM% current pulse width modulation ?24 % |map.MotorRPM| % current pulse width modulation ? 25 25 % 26 % map.Flags% should be always ''. Flags are considered in MAP_SetOutputModule.26 % |map.Flags| % should be always ''. Flags are considered in MAP_SetOutputModule. 27 27 % 28 % map.Mode% output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED28 % |map.Mode| % output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED 29 29 % 30 % map.ModeName% output mode name interpreted by output mode bitfield30 % |map.ModeName| % output mode name interpreted by output mode bitfield 31 31 % 32 % map.Speed% motor power/speed32 % |map.Speed| % motor power/speed 33 33 % 34 % map.ActualSpeed% current actual percentage of full power (regulation mode)34 % |map.ActualSpeed| % current actual percentage of full power (regulation mode) 35 35 % 36 % map.RegPParameter% proportional term of the internal PID control algorithm36 % |map.RegPParameter| % proportional term of the internal PID control algorithm 37 37 % 38 % map.RegIParameter% integral term of the internal PID control algorithm38 % |map.RegIParameter| % integral term of the internal PID control algorithm 39 39 % 40 % map.RegDParameter% derivate term of the internal PID control algorithm40 % |map.RegDParameter| % derivate term of the internal PID control algorithm 41 41 % 42 % map.RunStateByte% run state byte42 % |map.RunStateByte| % run state byte 43 43 % 44 % map.RunStateName% run state name interpreted by run state byte44 % |map.RunStateName| % run state name interpreted by run state byte 45 45 % 46 % map.RegModeByte% regulation mode byte46 % |map.RegModeByte| % regulation mode byte 47 47 % 48 % map.RegModeName% regulation mode name interpreted by regulation mode byte48 % |map.RegModeName| % regulation mode name interpreted by regulation mode byte 49 49 % 50 % map.Overloaded% overloaded flag (true: speed regulation is unable to onvercome50 % |map.Overloaded| % overloaded flag (true: speed regulation is unable to onvercome 51 51 % physical load on the motor) 52 52 % 53 % map.SyncTurnParam% current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume53 % |map.SyncTurnParam| % current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume 54 54 % 55 55 % Examples 56 % map = MAP_GetOutputModule(MOTOR_A);56 %+ map = MAP_GetOutputModule(MOTOR_A); 57 57 % 58 % map = MAP_GetOutputModule('all');58 %+ map = MAP_GetOutputModule('all'); 59 59 % 60 60 % See also: NXT_ReadIOMap … … 65 65 % Copyright: 2007-2008, RWTH Aachen University 66 66 % 67 ; 67 68 % 68 69 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_GetSoundModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % map = MAP_GetSoundModule()5 % |map = MAP_GetSoundModule()| 6 6 % 7 7 % Description 8 % map = MAP_GetSoundModule() returns the IO map of the sound module. The return value mapis8 % |map = MAP_GetSoundModule()| returns the IO map of the sound module. The return value |map| is 9 9 % a struct variable. It contains all sound module information. 10 10 % 11 11 % Output: 12 % map.Frequency% frequency of the last played ton in Hz12 % |map.Frequency| % frequency of the last played ton in Hz 13 13 % 14 % map.Duration% duration of the last played ton in ms14 % |map.Duration| % duration of the last played ton in ms 15 15 % 16 % map.SamplingRate% current sound sample rate16 % |map.SamplingRate| % current sound sample rate 17 17 % 18 % map.SoundFileName% sound file name of the last played sound file18 % |map.SoundFileName| % sound file name of the last played sound file 19 19 % 20 % map.Flags% sound module flag, 'IDLE': sound module is idle, 'UPDATE': a20 % |map.Flags| % sound module flag, 'IDLE': sound module is idle, 'UPDATE': a 21 21 % request for plackback is pending, 'RUNNING': playback in 22 22 % progress. 23 23 % 24 % map.State% sound module state, 'IDLE'; sound module is idel,24 % |map.State| % sound module state, 'IDLE'; sound module is idel, 25 25 % 'PLAYING_FILE': sound module is playing a .rso file, 26 26 % 'PLAYING_TONE': a tone is playing, 'STOP': a request to stop 27 27 % playback is in progress. 28 28 % 29 % map.Mode% sound module mode, 'ONCE': only play file once , 'LOOP': play29 % |map.Mode| % sound module mode, 'ONCE': only play file once , 'LOOP': play 30 30 % file in a loop, 'TONE': play tone. 31 31 % 32 % map.Volume% volume: 0: diabled, 1: 25%, 2:50%, 3:75%, 4:100% of full volume32 % |map.Volume| % volume: 0: diabled, 1: 25%, 2:50%, 3:75%, 4:100% of full volume 33 33 % 34 34 % Examples 35 % map = MAP_GetSoundModule();35 %+ map = MAP_GetSoundModule(); 36 36 % 37 37 % See also: NXT_ReadIOMap … … 42 42 % Copyright: 2007-2008, RWTH Aachen University 43 43 % 44 ; 44 45 % 45 46 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_GetUIModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % map = MAP_GetUIModule()5 % |map = MAP_GetUIModule()| 6 6 % 7 7 % Description 8 % map = MAP_GetUIModule()returns the IO map of the user interface module. The return9 % value mapis a struct variable. It contains all user interface module information.8 % |map = MAP_GetUIModule()| returns the IO map of the user interface module. The return 9 % value |map| is a struct variable. It contains all user interface module information. 10 10 % 11 11 % Output: 12 % map.PMenu% ?12 % |map.PMenu| % ? 13 13 % 14 % map.BatteryVoltage% battery voltage in mili volt.14 % |map.BatteryVoltage| % battery voltage in mili volt. 15 15 % 16 % map.LMSfilename% ?16 % |map.LMSfilename| % ? 17 17 % 18 % map.Flags% flag bitfield18 % |map.Flags| % flag bitfield 19 19 % 20 % map.State% state value20 % |map.State| % state value 21 21 % 22 % map.Button% button value22 % |map.Button| % button value 23 23 % 24 % map.RunState% VM run state24 % |map.RunState| % VM run state 25 25 % 26 % map.BatteryState% battery level (0..4)26 % |map.BatteryState| % battery level (0..4) 27 27 % 28 % map.BluetoothState% bluetooth state bitfield28 % |map.BluetoothState| % bluetooth state bitfield 29 29 % 30 % map.UsbState% USB state30 % |map.UsbState| % USB state 31 31 % 32 % map.SleepTimout% sleep timeout value in minutes32 % |map.SleepTimout| % sleep timeout value in minutes 33 33 % 34 % map.SleepTimer% current sleep timer in minutes34 % |map.SleepTimer| % current sleep timer in minutes 35 35 % 36 % map.Rechargeable% true if reachargeable battery is used36 % |map.Rechargeable| % true if reachargeable battery is used 37 37 % 38 % map.Volume% volume level (0..4)38 % |map.Volume| % volume level (0..4) 39 39 % 40 % map.Error% error value40 % |map.Error| % error value 41 41 % 42 % map.OBPPointer% on brick program pointer42 % |map.OBPPointer| % on brick program pointer 43 43 % 44 % map.ForceOff% turn off brick if value is true44 % |map.ForceOff| % turn off brick if value is true 45 45 % 46 46 % 47 47 % Examples 48 % map = MAP_GetUIModule();48 %+ map = MAP_GetUIModule(); 49 49 % 50 50 % See also: NXT_ReadIOMap … … 55 55 % Copyright: 2007- 2008, RWTH Aachen University 56 56 % 57 ; 57 58 % 58 59 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MAP_SetOutputModule.m
r201 r282 3 3 % 4 4 % Syntax 5 % MAP_SetOutputModule(motor, map)6 % 7 % MAP_SetOutputModule(motor, map, varargin)5 % |MAP_SetOutputModule(motor, map)| 6 % 7 % |MAP_SetOutputModule(motor, map, varargin)| 8 8 % 9 9 % Description 10 % map = MAP_SetOutputModule(motor, map) writes the IO mapto the output module at the given motor11 % motor. The motor port can be addressed by MOTOR_A, MOTOR_B, MOTOR_C. The mapstructure has10 % |map = MAP_SetOutputModule(motor, map)| writes the IO |map| to the output module at the given motor 11 % |motor|. The |motor| port can be addressed by |MOTOR_A|, |MOTOR_B|, |MOTOR_C|. The |map| structure has 12 12 % to provide all output module information, listed below. 13 13 % 14 14 % Input: 15 % map.TachoCount% internal, non-resettable rotation-counter (in degrees)16 % 17 % map.BlockTachoCount% block tacho counter, current motor position, resettable using,15 % |map.TachoCount| % internal, non-resettable rotation-counter (in degrees) 16 % 17 % |map.BlockTachoCount| % block tacho counter, current motor position, resettable using, 18 18 % ResetMotorAngle (NXT-G counter since block start) 19 19 % 20 % map.RotationCount% rotation tacho counter, current motor position (NXT-G counter20 % |map.RotationCount| % rotation tacho counter, current motor position (NXT-G counter 21 21 % since program start) 22 22 % 23 % map.TachoLimit% current set tacho/angle limit, 0 means none set24 % 25 % map.MotorRPM% current pulse width modulation ?26 % 27 % map.Flags% update flag bitfield, commits any changing (see also varargin)28 % 29 % map.Mode% output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED30 % 31 % map.Speed% current motor power/speed32 % 33 % map.ActualSpeed% current actual percentage of full power (regulation mode)34 % 35 % map.RegPParameter% proportional term of the internal PID control algorithm36 % 37 % map.RegIParameter% integral term of the internal PID control algorithm38 % 39 % map.RegDParameter% derivate term of the internal PID control algorithm40 % 41 % map.RunStateByte% run state byte42 % 43 % map.RegModeByte% regulation mode byte44 % 45 % map.Overloaded% overloaded flag (true: speed regulation is unable to onvercome23 % |map.TachoLimit| % current set tacho/angle limit, 0 means none set 24 % 25 % |map.MotorRPM| % current pulse width modulation ? 26 % 27 % |map.Flags| % update flag bitfield, commits any changing (see also varargin) 28 % 29 % |map.Mode| % output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED 30 % 31 % |map.Speed| % current motor power/speed 32 % 33 % |map.ActualSpeed| % current actual percentage of full power (regulation mode) 34 % 35 % |map.RegPParameter| % proportional term of the internal PID control algorithm 36 % 37 % |map.RegIParameter| % integral term of the internal PID control algorithm 38 % 39 % |map.RegDParameter| % derivate term of the internal PID control algorithm 40 % 41 % |map.RunStateByte| % run state byte 42 % 43 % |map.RegModeByte| % regulation mode byte 44 % 45 % |map.Overloaded| % overloaded flag (true: speed regulation is unable to onvercome 46 46 % physical load on the motor) 47 47 % 48 % map.SyncTurnParam% current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume48 % |map.SyncTurnParam| % current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume 49 49 % 50 50 % map = MAP_SetOutputModule(motor, map, varargin) sets the update flags explicit by the given … … 60 60 % 61 61 % Examples 62 % MAP_SetOutputModule(MOTOR_A, map);63 % 64 % map = MAP_GetOutputModule(MOTOR_A);65 % map.RegPParameter = 20;66 % MAP_SetOutputModule(MOTOR_A, map, 'UpdatePID');62 %+ MAP_SetOutputModule(MOTOR_A, map); 63 % 64 %+ map = MAP_GetOutputModule(MOTOR_A); 65 %+ map.RegPParameter = 20; 66 %+ MAP_SetOutputModule(MOTOR_A, map, 'UpdatePID'); 67 67 % 68 68 % See also: MAP_GetOutputModule, NXT_WriteIOMap … … 73 73 % Copyright: 2007-2008, RWTH Aachen University 74 74 % 75 ; 75 76 % 76 77 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MOTOR_A.m
r201 r282 3 3 % 4 4 % Syntax 5 % portA = MOTOR_A()5 % |portA = MOTOR_A()| 6 6 % 7 7 % Description 8 % portA = MOTOR_A() returns 0 as the value portA.8 % |portA = MOTOR_A()| returns |0| as the value |portA|. 9 9 % 10 10 % Example 11 % portA = MOTOR_A()12 % %result: >> portA = 011 %+ portA = MOTOR_A() 12 %+ %result: >> portA = 0 13 13 % 14 14 % See also: MOTOR_B, MOTOR_C … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MOTOR_B.m
r201 r282 3 3 % 4 4 % Syntax 5 % portB = MOTOR_B()5 % |portB = MOTOR_B()| 6 6 % 7 7 % Description 8 % portB = MOTOR_B() returns 1 as the value portB.8 % |portB = MOTOR_B()| returns |1| as the value |portB|. 9 9 % 10 10 % Example 11 % portB = MOTOR_B()12 % %result: >> portB = 111 %+ portB = MOTOR_B() 12 %+ %result: >> portB = 1 13 13 % 14 14 % See also: MOTOR_A, MOTOR_C … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MOTOR_C.m
r201 r282 3 3 % 4 4 % Syntax 5 % portC = MOTOR_C()5 % |portC = MOTOR_C()| 6 6 % 7 7 % Description 8 % portC = MOTOR_C() returns 2 as the value portC.8 % |portC = MOTOR_C()| returns |2| as the value |portC|. 9 9 % 10 10 % Example 11 % portC = MOTOR_C()12 % %result: >> portC = 211 %+ portC = MOTOR_C() 12 %+ %result: >> portC = 2 13 13 % 14 14 % See also: MOTOR_A, MOTOR_B … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/MotorRotateAbs.m
r201 r282 3 3 % 4 4 % Syntax 5 % MotorRotateAbs(port,abs_angle,power)5 % |MotorRotateAbs(port,abs_angle,power)| 6 6 % 7 7 % Description 8 % MotorRotateAbs(port,abs_angle,power)rotates the motor connected to the given9 % port. The value port can be addressed by the symbolic constants MOTOR_A, MOTOR_Band10 % MOTOR_C analog to the labeling on the NXT Brick. The angledetermines the absolute angle to11 % rotate. power represents the motor power (1...100).8 % |MotorRotateAbs(port,abs_angle,power)| rotates the motor connected to the given 9 % |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A|, |MOTOR_B| and 10 % |MOTOR_C| analog to the labeling on the NXT Brick. The |angle| determines the absolute angle to 11 % rotate. |power| represents the motor power (|1...100|). 12 12 % 13 13 % Note: … … 15 15 % 16 16 % Example 17 % MotorRotateAbs(MOTOR_B, 550, 30);17 %+ MotorRotateAbs(MOTOR_B, 550, 30); 18 18 % 19 19 % See also: SetMemoryCount, GetMemoryCount, NXT_SetOutputState, MOTOR_A, MOTOR_B, MOTOR_C … … 24 24 % Copyright: 2007-2008, RWTH Aachen University 25 25 % 26 ; 26 27 % 27 28 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_GetBatteryLevel.m
r201 r282 3 3 % 4 4 % Syntax 5 % voltage = NXT_GetBatteryLevel()5 % |voltage = NXT_GetBatteryLevel()| 6 6 % 7 % voltage = NXT_GetBatteryLevel(handle)7 % |voltage = NXT_GetBatteryLevel(handle)| 8 8 % 9 9 % Description 10 % voltage = NXT_GetBatteryLevel() returns the current battery level voltageof the NXT Brick in milli10 % |voltage = NXT_GetBatteryLevel()| returns the current battery level |voltage| of the NXT Brick in milli 11 11 % voltage. 12 12 % 13 % voltage = NXT_GetBatteryLevel(handle) uses the given Bluetooth connection handle. This should be a13 % |voltage = NXT_GetBatteryLevel(handle)| uses the given Bluetooth connection |handle|. This should be a 14 14 % serial handle on a PC system and a file handle on a Linux system. 15 15 % 16 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.16 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 17 17 % 18 18 % Examples 19 % voltage = NXT_GetBatteryLevel();19 %+ voltage = NXT_GetBatteryLevel(); 20 20 % 21 % handle = COM_OpenNXT('bluetooth.ini','check');22 % voltage = NXT_GetBatteryLevel(handle);21 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 22 %+ voltage = NXT_GetBatteryLevel(handle); 23 23 % 24 24 % See also: COM_GetDefaultNXT, NXT_SendKeepAlive … … 29 29 % Copyright: 2007-2008, RWTH Aachen University 30 30 % 31 ; 31 32 % 32 33 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_GetFirmwareVersion.m
r201 r282 3 3 % 4 4 % Syntax 5 % [protocol_version firmware_version] = NXT_GetFirmwareVersion()5 % |[protocol_version firmware_version] = NXT_GetFirmwareVersion()| 6 6 % 7 % [protocol_version firmware_version] = NXT_GetFirmwareVersion(handle)7 % |[protocol_version firmware_version] = NXT_GetFirmwareVersion(handle)| 8 8 % 9 9 % Description 10 % [protocol_version firmware_version] = NXT_GetFirmwareVersion()returns the protocol and10 % |[protocol_version firmware_version] = NXT_GetFirmwareVersion()| returns the protocol and 11 11 % firmware version of the NXT as strings. 12 12 % 13 % [protocol_version firmware_version] = NXT_GetFirmwareVersion(handle)uses the given14 % NXT connection handle. This should be a struct containing a serial handle on a PC system and a file handle on a Linux system.13 % |[protocol_version firmware_version] = NXT_GetFirmwareVersion(handle)| uses the given 14 % NXT connection |handle|. This should be a struct containing a serial handle on a PC system and a file handle on a Linux system. 15 15 % 16 % If no NXT handle is specified the default one (COM_GetDefaultNXT) is used.16 % If no NXT |handle| is specified the default one (|COM_GetDefaultNXT|) is used. 17 17 % 18 18 % Examples 19 % [protocol_version firmware_version] = NXT_GetFirmwareVersion();19 %+ [protocol_version firmware_version] = NXT_GetFirmwareVersion(); 20 20 % 21 % handle = COM_OpenNXT('bluetooth.ini','check');22 % [protocol_version firmware_version] = NXT_GetFirmwareVersion(handle);21 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 22 %+ [protocol_version firmware_version] = NXT_GetFirmwareVersion(handle); 23 23 % 24 24 % See also: COM_GetDefaultNXT … … 29 29 % Copyright: 2007-2008, RWTH Aachen University 30 30 % 31 ; 31 32 % 32 33 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_GetInputValues.m
r201 r282 3 3 % 4 4 % Syntax 5 % data = NXT_GetInputValues(port)6 % 7 % data = NXT_GetInputValues(port, handle)5 % |data = NXT_GetInputValues(port)| 6 % 7 % |data = NXT_GetInputValues(port, handle)| 8 8 % 9 9 % Description 10 % data = NXT_GetInputValues(port)processes a complete sensor reading, i.e. requests input11 % values and collects the answer of the given sensor port. The value portcan be addressed by12 % the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling13 % on the NXT Brick. The return value datais a struct variable. It contains several sensor10 % |data = NXT_GetInputValues(port)| processes a complete sensor reading, i.e. requests input 11 % values and collects the answer of the given sensor |port|. The value |port| can be addressed by 12 % the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling 13 % on the NXT Brick. The return value |data| is a struct variable. It contains several sensor 14 14 % settings and information. 15 15 % 16 % data = NXT_GetInputValues(port, handle) uses the given Bluetooth connection handle. This should be a16 % |data = NXT_GetInputValues(port, handle)| uses the given Bluetooth connection |handle|. This should be a 17 17 % serial handle on a PC system and a file handle on a Linux system. 18 18 % 19 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.19 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 20 20 % 21 21 % Output: 22 % data.Port % current port number (0..3)23 % 24 % data.Valid% validation flag25 % 26 % data.Calibrated % boolean, trueif calibration file found and used27 % 28 % data.TypeByte% sensor type29 % 30 % data.TypeName% sensor mode31 % 32 % data.ModeByte% mode33 % 34 % data.ModeName% mode name35 % 36 % data.RawADVal% raw A/D value37 % 38 % data.NormalizedADVal% normalized A/D value39 % 40 % data.ScaledVal% scaled value41 % 42 % data.CalibratedVal% calibrated value22 % |data.Port| % current port number (|0..3|) 23 % 24 % |data.Valid| % validation flag 25 % 26 % |data.Calibrated| % boolean, |true| if calibration file found and used 27 % 28 % |data.TypeByte| % sensor type 29 % 30 % |data.TypeName| % sensor mode 31 % 32 % |data.ModeByte| % mode 33 % 34 % |data.ModeName| % mode name 35 % 36 % |data.RawADVal| % raw A/D value 37 % 38 % |data.NormalizedADVal| % normalized A/D value 39 % 40 % |data.ScaledVal| % scaled value 41 % 42 % |data.CalibratedVal| % calibrated value 43 43 % 44 44 % Note: 45 % Data are only valid if .Validis ~= 0. This should usually be the45 % Data are only valid if |.Valid| is ~= 0. This should usually be the 46 46 % case, but a short while after setting a new sensor mode using 47 % NXT_SetInputMode, you have to carefully check .Valid on your own!48 % Experience shows that only .ScaledValis influenced by this, apparently49 % .NormalizedADValseems valid all the time, but closer examination is47 % |NXT_SetInputMode|, you have to carefully check .Valid on your own! 48 % Experience shows that only |.ScaledVal| is influenced by this, apparently 49 % |.NormalizedADVal| seems valid all the time, but closer examination is 50 50 % needed... 51 51 % … … 53 53 % 54 54 % Examples 55 % data = NXT_GetInputValues(SENSOR_3);56 % 57 % handle = COM_OpenNXT('bluetooth.ini','check');58 % data = NXT_GetInputValues(SENSOR_1, handle);55 %+ data = NXT_GetInputValues(SENSOR_3); 56 % 57 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 58 %+ data = NXT_GetInputValues(SENSOR_1, handle); 59 59 % 60 60 % See also: NXT_SetInputMode, GetLight, GetSwitch, GetSound, GetUltrasonic, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 65 65 % Copyright: 2007-2008, RWTH Aachen University 66 66 % 67 ; 67 68 % 68 69 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_GetOutputState.m
r201 r282 3 3 % 4 4 % Syntax 5 % data = NXT_GetOutputState(port)6 % 7 % data = NXT_GetOutputState(port, handle)5 % |data = NXT_GetOutputState(port)| 6 % 7 % |data = NXT_GetOutputState(port, handle)| 8 8 % 9 9 % Description 10 % data = NXT_GetOutputState(port)requests and retrieves an output motor state reading of the11 % given motor port. The value port can be addressed by the symbolic constants MOTOR_A,12 % MOTOR_B and MOTOR_C analog to the labeling on the NXT Brick. The return value datais a10 % |data = NXT_GetOutputState(port)| requests and retrieves an output motor state reading of the 11 % given motor |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A|, 12 % |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT Brick. The return value |data| is a 13 13 % struct variable. It contains several motor settings and information. 14 14 % 15 % data = NXT_GetOutputState(port, handle) uses the given Bluetooth connection handle. This should be a15 % |data = NXT_GetOutputState(port, handle)| uses the given Bluetooth connection |handle|. This should be a 16 16 % serial handle on a PC system and a file handle on a Linux system. 17 17 % 18 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.18 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 19 19 % 20 20 % Output: 21 % data.Port % current port number (0..3)22 % 23 % data.Power% current motor power24 % 25 % data.Mode% motor mode byte26 % 27 % data.ModeIsMOTORON% flag: "motor is on"28 % 29 % data.ModeIsBRAKE% flag: "motor uses the advanced brake mode (PVM)"30 % 31 % data.ModeIsREGULATED% flag: "motor uses a regulation"32 % 33 % data.RegModeByte% motor regulation byte34 % 35 % data.RegModeName% name of regulation mode36 % 37 % data.TurnRatio% turn ratio value38 % 39 % data.RunStateByte% motor run state byte40 % 41 % data.RegStateName% name of run state42 % 43 % data.TachoLimit% tacho / angle limit44 % 45 % data.TachoCount% current absolute tacho count46 % 47 % data.BlockTachoCount% current relative tacho count48 % 49 % data.RotationCount% current second relative tacho count21 % |data.Port| % current port number (|0..3|) 22 % 23 % |data.Power| % current motor power 24 % 25 % |data.Mode| % motor mode byte 26 % 27 % |data.ModeIsMOTORON| % flag: "motor is on" 28 % 29 % |data.ModeIsBRAKE| % flag: "motor uses the advanced brake mode (PVM)" 30 % 31 % |data.ModeIsREGULATED| % flag: "motor uses a regulation" 32 % 33 % |data.RegModeByte| % motor regulation byte 34 % 35 % |data.RegModeName| % name of regulation mode 36 % 37 % |data.TurnRatio| % turn ratio value 38 % 39 % |data.RunStateByte| % motor run state byte 40 % 41 % |data.RegStateName| % name of run state 42 % 43 % |data.TachoLimit| % tacho / angle limit 44 % 45 % |data.TachoCount| % current absolute tacho count 46 % 47 % |data.BlockTachoCount| % current relative tacho count 48 % 49 % |data.RotationCount| % current second relative tacho count 50 50 % 51 51 % For more details see the official LEGO Mindstorms communication protocol. 52 52 % 53 53 % Examples 54 % data = NXT_GetOutputState(MOTOR_B);55 % 56 % handle = COM_OpenNXT('bluetooth.ini','check');57 % data = NXT_GetOutputState(MOTOR_A, handle);54 %+ data = NXT_GetOutputState(MOTOR_B); 55 % 56 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 57 %+ data = NXT_GetOutputState(MOTOR_A, handle); 58 58 % 59 59 % See also: GetMotorSettings, SendMotorSettings, NXT_SetOutputState, MOTOR_A, MOTOR_B, MOTOR_C … … 64 64 % Copyright: 2007-2008, RWTH Aachen University 65 65 % 66 ; 66 67 % 67 68 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_LSGetStatus.m
r201 r282 3 3 % 4 4 % Syntax 5 % [BytesReady status] = NXT_LSGetStatus(port)5 % |[BytesReady status] = NXT_LSGetStatus(port)| 6 6 % 7 % [BytesReady status] = NXT_LSGetStatus(port, handle)7 % |[BytesReady status] = NXT_LSGetStatus(port, handle)| 8 8 % 9 9 % Description 10 % [BytesReady status] = NXT_LSGetStatus(port)gets the number of available bytes from the low speed (digital)11 % sensor reading of the given sensor port. The value portcan be addressed by12 % the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling13 % on the NXT Brick. The return value BytesReadycontains the number of bytes available to read.14 % status indicates if an error occures by the packet transmission. Function checkStatusBytes10 % |[BytesReady status] = NXT_LSGetStatus(port)| gets the number of available bytes from the low speed (digital) 11 % sensor reading of the given sensor |port|. The value |port| can be addressed by 12 % the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling 13 % on the NXT Brick. The return value |BytesReady| contains the number of bytes available to read. 14 % |status| indicates if an error occures by the packet transmission. Function |checkStatusBytes| 15 15 % is interpreting this information per default. 16 16 % 17 % [BytesReady status] = NXT_LSGetStatus(port, handle) uses the given Bluetooth connection handle. This should be a17 % |[BytesReady status] = NXT_LSGetStatus(port, handle)| uses the given Bluetooth connection |handle|. This should be a 18 18 % serial handle on a PC system and a file handle on a Linux system. 19 19 % 20 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.20 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 21 21 % 22 22 % For more details see the official LEGO Mindstorms communication protocol. … … 28 28 % 29 29 % Before using LS commands, the sensor mode has to be set to 30 % LOWSPEED_9Vusing the NXT_SetInputMode command.30 % |LOWSPEED_9V| using the NXT_SetInputMode command. 31 31 % 32 32 % 33 33 % Examples 34 % [BytesReady status] = NXT_LSGetStatus(SENSOR_3);34 %+ [BytesReady status] = NXT_LSGetStatus(SENSOR_3); 35 35 % 36 % handle = COM_OpenNXT('bluetooth.ini','check');37 % NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply');38 % % note that status can contain errorsmessages, use checkStatusByte39 % [BytesReady status] = NXT_LSGetStatus(SENSOR_1, handle);36 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 37 %+ NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); 38 %+ % note that status can contain errorsmessages, use checkStatusByte 39 %+ [BytesReady status] = NXT_LSGetStatus(SENSOR_1, handle); 40 40 % 41 41 % See also: NXT_SetInputMode, checkStatusByte, NXT_LSWrite, NXT_LSRead … … 47 47 % Copyright: 2007-2008, RWTH Aachen University 48 48 % 49 ; 49 50 % 50 51 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_LSRead.m
r201 r282 1 function [data BytesRead ] = NXT_LSRead(port, varargin)1 function [data BytesRead optionalStatusByte] = NXT_LSRead(port, varargin) 2 2 % Reads data from a low speed (digital) sensor 3 3 % 4 4 % Syntax 5 % [data BytesRead] = NXT_LSRead(port)5 % |[data BytesRead] = NXT_LSRead(port)| 6 6 % 7 % [data BytesRead] = NXT_LSRead(port, handle) 7 % |[data BytesRead] = NXT_LSRead(port, handle)| 8 % 9 % |[data BytesRead optionalStatusByte] = NXT_LSRead(port, [handle])| 8 10 % 9 11 % Description 10 % [data BytesRead] = NXT_LSRead(port)) gets the dataof the low speed (digital) sensor value11 % of the given sensor port. The value portcan be addressed by the symbolic constants12 % SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick. The13 % return value BytesReadcontains the number of bytes available to read.12 % |[data BytesRead] = NXT_LSRead(port))| gets the |data| of the low speed (digital) sensor value 13 % of the given sensor |port|. The value |port| can be addressed by the symbolic constants 14 % |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. The 15 % return value |BytesRead| contains the number of bytes available to read. 14 16 % 15 % [data BytesRead] = NXT_LSRead(port, handle) uses the given Bluetooth connection handle. This should be a17 % |[data BytesRead] = NXT_LSRead(port, handle)| uses the given Bluetooth connection |handle|. This should be a 16 18 % serial handle on a PC system and a file handle on a Linux system. 17 19 % 18 % If no Bluetooth handle is specified the default one (COM_GetDefaultNXT) is used. 20 % |[data BytesRead optionalStatusByte] = NXT_LSRead(port, [handle])| will 21 % ignore the automatic statusbyte check and instead return it as output 22 % argument. This causes the function to ignore erronous I2C calls or 23 % crashes if the sensor is not yet ready. You can effectively save a call 24 % to |NXT_LSGetStatus| with this, if you interpret the statusbytes 25 % correctly. This may vary, depending on your I2C sensor. The |handle| 26 % argument is still optional, like above. 27 % 28 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 19 29 % 20 30 % … … 27 37 % 28 38 % Before using LS commands, the sensor mode has to be set to 29 % LOWSPEED_9Vusing the NXT_SetInputMode command.39 % |LOWSPEED_9V| using the NXT_SetInputMode command. 30 40 % 31 41 % Examples 32 % handle = COM_OpenNXT('bluetooth.ini','check');33 % 34 % NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply');35 % % usually we would use NXT_LSWrite before, to request some sort of reply36 % [data BytesRead] = NXT_LSRead(SENSOR_1, handle);42 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 43 %+ 44 %+ NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); 45 %+ % usually we would use NXT_LSWrite before, to request some sort of reply 46 %+ [data BytesRead] = NXT_LSRead(SENSOR_1, handle); 37 47 % 38 48 % See also: NXT_SetInputMode, NXT_LSWrite, NXT_LSGetStatus … … 44 54 % Copyright: 2007-2008, RWTH Aachen University 45 55 % 56 ; 46 57 % 47 58 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_LSWrite.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_LSWrite(port, RXLength, data, ReplyMode)5 % |NXT_LSWrite(port, RXLength, data, ReplyMode)| 6 6 % 7 % NXT_LSWrite(port, RXLength, data, ReplyMode, handle)7 % |NXT_LSWrite(port, RXLength, data, ReplyMode, handle)| 8 8 % 9 9 % Description 10 % NXT_LSWrite(port, RXLength, data, ReplyMode) writes the given datato a low speed (digital)11 % sensor of the given sensor port. The value portcan be addressed by the symbolic constants12 % SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick. The13 % value RXLength represents the data length of the expected receiving packet. By the ReplyMode14 % one can request an acknowledgement for the packet transmission. The two strings 'reply'and15 % 'dontreply'are valid.10 % |NXT_LSWrite(port, RXLength, data, ReplyMode)| writes the given |data| to a low speed (digital) 11 % sensor of the given sensor |port|. The value |port| can be addressed by the symbolic constants 12 % |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. The 13 % value |RXLength| represents the data length of the expected receiving packet. By the |ReplyMode| 14 % one can request an acknowledgement for the packet transmission. The two strings |'reply'| and 15 % |'dontreply'| are valid. 16 16 % 17 % NXT_LSWrite(port, RXLength, data, ReplyMode, handle)uses the given Bluetooth connection18 % handle. This should be a serial handle on a PC system and a file handle on a Linux system.17 % |NXT_LSWrite(port, RXLength, data, ReplyMode, handle)| uses the given Bluetooth connection 18 % |handle|. This should be a serial handle on a PC system and a file handle on a Linux system. 19 19 % 20 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.20 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 21 21 % 22 22 % For more details see the official LEGO Mindstorms communication protocol. … … 28 28 % 29 29 % Before using LS commands, the sensor mode has to be set to 30 % LOWSPEED_9Vusing the NXT_SetInputMode command.30 % |LOWSPEED_9V| using the NXT_SetInputMode command. 31 31 % 32 32 % Example 33 % RequestLen = 1;34 % I2Cdata = hex2dec(['02'; '42']); % specific ultrasonic I²C command35 % 36 % handle = COM_OpenNXT('bluetooth.ini','check');37 % NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply');38 % 39 % NXT_LSWrite(SENSOR_1, RequestLen, I2Cdata, 'dontreply', handle);33 %+ RequestLen = 1; 34 %+ I2Cdata = hex2dec(['02'; '42']); % specific ultrasonic I²C command 35 %+ 36 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 37 %+ NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); 38 %+ 39 %+ NXT_LSWrite(SENSOR_1, RequestLen, I2Cdata, 'dontreply', handle); 40 40 % 41 41 % See also: NXT_SetInputMode, NXT_LSRead, NXT_LSGetStatus … … 47 47 % Copyright: 2007-2008, RWTH Aachen University 48 48 % 49 ; 49 50 % 50 51 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_PlaySoundFile.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_PlaySoundFile(filename, 'loop')5 % |NXT_PlaySoundFile(filename, 'loop')| 6 6 % 7 % NXT_PlaySoundFile(filename, '', handle)7 % |NXT_PlaySoundFile(filename, '', handle)| 8 8 % 9 9 % Description 10 % NXT_PlaySoundFile(filename, loop)plays the soundfile stored on NXT Brick determined by11 % the string filename. The maximum length is limited to 15 characters. The file10 % |NXT_PlaySoundFile(filename, loop)| plays the soundfile stored on NXT Brick determined by 11 % the string |filename|. The maximum length is limited to 15 characters. The file 12 12 % extension '.rso' is added automatically if it was omitted. If the loop 13 % parameter is equal to 'loop'the playback loop is activated.13 % parameter is equal to |'loop'| the playback loop is activated. 14 14 % 15 % NXT_PlaySoundFile(name, loop, handle) uses the given NXT connection handle.15 % |NXT_PlaySoundFile(name, loop, handle)| uses the given NXT connection |handle|. 16 16 % This should be a a struct containing a serial handle on a PC system and a file handle on a Linux system. 17 17 % 18 % If no Bluetooth handle is specified the default one (COM_GetDefaultNXT) is used.18 % If no Bluetooth |handle| is specified the default one (|COM_GetDefaultNXT|) is used. 19 19 % 20 20 % For more details see the official LEGO Mindstorms communication protocol. 21 21 % 22 22 % Examples 23 % NXT_PlaySoundFile('Goodmorning', 0);23 %+ NXT_PlaySoundFile('Goodmorning', 0); 24 24 % 25 % handle = NXT_OpenNXT('bluetooth.ini','check');26 % NXT_StartProgram('Goodmorning.rso', 1, handle);25 %+ handle = NXT_OpenNXT('bluetooth.ini','check'); 26 %+ NXT_StartProgram('Goodmorning.rso', 1, handle); 27 27 % 28 28 % See also: NXT_StopSoundPlayback … … 33 33 % Copyright: 2007-2008, RWTH Aachen University 34 34 % 35 ; 35 36 % 36 37 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_PlayTone.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_PlayTone(frequency, duration)5 % |NXT_PlayTone(frequency, duration)| 6 6 % 7 % NXT_PlayTone(frequency, duration, handle)7 % |NXT_PlayTone(frequency, duration, handle)| 8 8 % 9 9 % Description 10 % NXT_PlayTone(frequency, duration) plays a tone of the frequencyin Hz (200 - 14000Hz) and the11 % durationin milli seconds.10 % |NXT_PlayTone(frequency, duration)| plays a tone of the |frequency| in Hz (200 - 14000Hz) and the 11 % |duration| in milli seconds. 12 12 % 13 % NXT_PlayTone(frequency, duration, handle)sends the play tone command over the specific13 % |NXT_PlayTone(frequency, duration, handle)| sends the play tone command over the specific 14 14 % NXT handle (e.g. struct containing a serial handle (PC) / file handle (Linux)). 15 15 % 16 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.16 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 17 17 % 18 18 % For more details see the official LEGO Mindstorms communication protocol. 19 19 % 20 20 % Examples 21 % NXT_PlayTone(440, 100);21 %+ NXT_PlayTone(440, 100); 22 22 % 23 % handle = COM_OpenNXT('bluetooth.ini','check');24 % COM_SetDefaultNXT(handle);25 % NXT_PlayTone(1200, 120);23 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 24 %+ COM_SetDefaultNXT(handle); 25 %+ NXT_PlayTone(1200, 120); 26 26 % 27 27 % See also: COM_GetDefaultNXT … … 32 32 % Copyright: 2007-2008, RWTH Aachen University 33 33 % 34 ; 34 35 % 35 36 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_ReadIOMap.m
r201 r282 3 3 % 4 4 % Syntax 5 % bytes = NXT_ReadIOMap(mod_id, offset, n_bytes)5 % |bytes = NXT_ReadIOMap(mod_id, offset, n_bytes)| 6 6 % 7 % bytes = NXT_ReadIOMap(mod_id, offset, n_bytes, handle)7 % |bytes = NXT_ReadIOMap(mod_id, offset, n_bytes, handle)| 8 8 % 9 9 % Description 10 % bytes = NXT_ReadIOMap(mod_id, offset, n_bytes) returns the data bytesof the module11 % identified by the given module ID mod_id. The total number of bytes is determined by n_bytes12 % and the position of the first byte index by the offsetparameter.10 % |bytes = NXT_ReadIOMap(mod_id, offset, n_bytes|) returns the data |bytes| of the module 11 % identified by the given module ID |mod_id|. The total number of bytes is determined by |n_bytes| 12 % and the position of the first byte index by the |offset| parameter. 13 13 % 14 % bytes = NXT_ReadIOMap(mod_id, offset, n_bytes, handle)sends the IO map read command15 % over the specific NXT handle(e.g. serial handle (PC) / file handle (Linux)).14 % |bytes = NXT_ReadIOMap(mod_id, offset, n_bytes, handle)| sends the IO map read command 15 % over the specific NXT |handle| (e.g. serial handle (PC) / file handle (Linux)). 16 16 % 17 % If no NXT handle is specified the default one (COM_GetDefaultNXT) is used.17 % If no NXT |handle| is specified the default one (|COM_GetDefaultNXT|) is used. 18 18 % 19 19 % For more details see the official LEGO Mindstorms communication protocol. 20 20 % 21 21 % Examples 22 % OutputModuleID = 13107323 % bytes = NXT_ReadIOMap(OutputModuleID, 0, 29);22 %+ OutputModuleID = 131073 23 %+ bytes = NXT_ReadIOMap(OutputModuleID, 0, 29); 24 24 % 25 % handle = COM_OpenNXT('bluetooth.ini','check');26 % OutputModuleID = 13107327 % SoundModuleID = 524289, 0, 30, handle);25 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 26 %+ OutputModuleID = 131073 27 %+ SoundModuleID = 524289, 0, 30, handle); 28 28 % 29 29 % See also: NXT_WriteIOMap, COM_GetDefaultNXT … … 34 34 % Copyright: 2007-2008, RWTH Aachen University 35 35 % 36 ; 36 37 % 37 38 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_ResetInputScaledValue.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_ResetInputScaledValue(port)5 % |NXT_ResetInputScaledValue(port)| 6 6 % 7 % NXT_ResetInputScaledValue(port, handle)7 % |NXT_ResetInputScaledValue(port, handle)| 8 8 % 9 9 % Description 10 % NXT_ResetInputScaledValue(port) resets the sensors ScaledVal back to 0of the given sensor11 % port. The value port can be addressed by the symbolic constants SENSOR_1, SENSOR_2,12 % SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick. The ScaledValis set by13 % function NXT_SetInputMode.10 % |NXT_ResetInputScaledValue(port)| resets the sensors |ScaledVal| back to |0| of the given sensor 11 % |port|. The value |port| can be addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, 12 % |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. The |ScaledVal| is set by 13 % function |NXT_SetInputMode|. 14 14 % 15 % NXT_ResetInputScaledValue(port, handle) uses the given NXT connection handle. This should be a15 % |NXT_ResetInputScaledValue(port, handle)| uses the given NXT connection |handle|. This should be a 16 16 % struct containing a serial handle on a PC system and a file handle on a Linux system. 17 17 % 18 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.18 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 19 19 % 20 20 % For more details see the official LEGO Mindstorms communication protocol. 21 21 % 22 22 % Note 23 % This function should be called after using NXT_SetInputMode, before you want to actually use your new24 % special input value (to make sure counting starts at zero). See NXT_GetInputValuesfor more details23 % This function should be called after using |NXT_SetInputMode|, before you want to actually use your new 24 % special input value (to make sure counting starts at zero). See |NXT_GetInputValues| for more details 25 25 % about what kind of values are returned. 26 26 % 27 27 % Examples 28 % NXT_ResetInputScaledValue(SENSOR_2);28 %+ NXT_ResetInputScaledValue(SENSOR_2); 29 29 % 30 % handle = COM_OpenNXT('bluetooth.ini','check');31 % NXT_ResetInputScaledValue(SENSOR_4, handle);30 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 31 %+ NXT_ResetInputScaledValue(SENSOR_4, handle); 32 32 % 33 33 % See also: NXT_SetInputMode, NXT_GetInputValues … … 38 38 % Copyright: 2007-2008, RWTH Aachen University 39 39 % 40 ; 40 41 % 41 42 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_ResetMotorPosition.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_ResetMotorPosition(port, isRelative)5 % |NXT_ResetMotorPosition(port, isRelative)| 6 6 % 7 % NXT_ResetMotorPosition(port, isRelative, handle)7 % |NXT_ResetMotorPosition(port, isRelative, handle)| 8 8 % 9 9 % Description 10 % NXT_ResetMotorPosition(port, isRelative)resets the NXT internal counter of the given motor11 % port. The value port can be addressed by the symbolic constants MOTOR_A, MOTOR_B,12 % MOTOR_C analog to the labeling on the NXT Brick. The boolean flag isRelativedetermines the10 % |NXT_ResetMotorPosition(port, isRelative)| resets the NXT internal counter of the given motor 11 % |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A|, |MOTOR_B|, 12 % |MOTOR_C| analog to the labeling on the NXT Brick. The boolean flag |isRelative| determines the 13 13 % relative (BlockTachoCount) or absolute counter (RotationCount). 14 14 % 15 % NXT_ResetMotorPosition(port, handle) uses the given NXT connection handle. This should be a15 % |NXT_ResetMotorPosition(port, handle)| uses the given NXT connection |handle|. This should be a 16 16 % struct containing a serial handle on a PC system and a file handle on a Linux system. 17 17 % 18 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.18 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 19 19 % 20 20 % For more details see the official LEGO Mindstorms communication protocol. 21 21 % 22 22 % Examples 23 % NXT_ResetMotorPosition(MOTOR_B, true);23 %+ NXT_ResetMotorPosition(MOTOR_B, true); 24 24 % 25 % handle = COM_OpenNXT('bluetooth.ini','check');26 % NXT_ResetMotorPosition(MOTOR_A, false, handle);25 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 26 %+ NXT_ResetMotorPosition(MOTOR_A, false, handle); 27 27 % 28 28 % See also: COM_GetDefaultNXT … … 33 33 % Copyright: 2007-2008, RWTH Aachen University 34 34 % 35 ; 35 36 % 36 37 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_SendKeepAlive.m
r201 r282 3 3 % 4 4 % Syntax 5 % [status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)5 % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)| 6 6 % 7 % [status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)7 % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)| 8 8 % 9 9 % Description 10 % [status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)sends a KeepAlive packet to the NXT11 % Brick to get the current sleep time limit of the Brick in milliseconds. By the ReplyMode12 % one can request an acknowledgement for the packet transmission. The two strings 'reply'and13 % 'dontreply' are valid. statusindicates if an error occures by the packet transmission.14 % Function checkStatusBytesis interpreting this information per default. The value15 % SleepTimeLimitcontains the time in milliseconds after the NXT brick will turn off16 % automatically. The variable will only be set if ReplyMode is 'reply'. The sleep time limit10 % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)| sends a KeepAlive packet to the NXT 11 % Brick to get the current sleep time limit of the Brick in milliseconds. By the |ReplyMode| 12 % one can request an acknowledgement for the packet transmission. The two strings |'reply'| and 13 % |'dontreply'| are valid. |status| indicates if an error occures by the packet transmission. 14 % Function |checkStatusBytes| is interpreting this information per default. The value 15 % |SleepTimeLimit| contains the time in milliseconds after the NXT brick will turn off 16 % automatically. The variable will only be set if |ReplyMode| is |'reply'|. The sleep time limit 17 17 % setting can only be modified using the on-screen-menu on the brick itself. 18 18 % 19 % Using 'dontreply'will just send a keep-alive packet. This means, the NXT internal counter when19 % Using |'dontreply'| will just send a keep-alive packet. This means, the NXT internal counter when 20 20 % to shut down automatically (this is a setting that can only be accessed directly on the NXT) 21 21 % will be reset. This counter is not an inactivity counter: Bluetooth traffic will NOT stop the … … 23 23 % Brick from turning off is to send a keep-alive packet within this time. 24 24 % 25 % If you use replymode 'reply', SleepTimeLimit tells you the current setting on the brick, in25 % If you use replymode |'reply'|, SleepTimeLimit tells you the current setting on the brick, in 26 26 % milliseconds. 0 means sleep timer is disabled. -1 is an invalid answer: You obviously didn't use 27 % 'reply'and still tried to get an answer.27 % |'reply'| and still tried to get an answer. 28 28 % 29 % [status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)uses the given NXT30 % connection handle. This should be a struct containing a serial handle on a PC system and a file handle on a Linux29 % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)| uses the given NXT 30 % connection |handle|. This should be a struct containing a serial handle on a PC system and a file handle on a Linux 31 31 % system. 32 32 % 33 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.33 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 34 34 % 35 35 % For more details see the official LEGO Mindstorms communication protocol. 36 36 % 37 37 % Note: 38 % This function is also used if you call COM_OpenNXT() with the optional 'check'parameter. Then38 % This function is also used if you call |COM_OpenNXT()| with the optional |'check'| parameter. Then 39 39 % a keep-alive packet is send and the answer will be received to check for a correctly working 40 40 % bidirectional bluetooth connection. 41 41 % 42 42 % Examples 43 % [status SleepTimeLimit] = NXT_SendKeepAlive('reply');43 %+ [status SleepTimeLimit] = NXT_SendKeepAlive('reply'); 44 44 % 45 % NXT_SendKeepAlive('dontreply');45 %+ NXT_SendKeepAlive('dontreply'); 46 46 % 47 % handle = COM_OpenNXT('bluetooth.ini','check');48 % [status SleepTimeLimit] = NXT_SendKeepAlive('reply', handle);47 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 48 %+ [status SleepTimeLimit] = NXT_SendKeepAlive('reply', handle); 49 49 % 50 50 % See also: COM_OpenNXT, NXT_GetBatteryLevel … … 55 55 % Copyright: 2007-2008, RWTH Aachen University 56 56 % 57 ; 57 58 % 58 59 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_SetBrickName.m
r201 r282 3 3 % 4 4 % Syntax 5 % [NXT_SetBrickName(name)5 % |[NXT_SetBrickName(name)| 6 6 % 7 % NXT_SetBrickName(name, handle)7 % |NXT_SetBrickName(name, handle)| 8 8 % 9 9 % Description 10 % NXT_SetBrickName(name) sets a new name for the NXT Brick. The value nameis a string value10 % |NXT_SetBrickName(name)| sets a new |name| for the NXT Brick. The value |name| is a string value 11 11 % and determines the new name of the Brick. The maximum length is limited to 15 characters. 12 12 % 13 % NXT_SetBrickName(name, handle) uses the given NXT connection handle. This should be13 % |NXT_SetBrickName(name, handle)| uses the given NXT connection |handle|. This should be 14 14 % a struct containing a serial handle on a PC system and a file handle on a Linux system. 15 15 % 16 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.16 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 17 17 % 18 18 % For more details see the official LEGO Mindstorms communication protocol. 19 19 % 20 20 % Examples 21 % NXT_SetBrickName('MyRobot');21 %+ NXT_SetBrickName('MyRobot'); 22 22 % 23 % handle = COM_OpenNXT('bluetooth.ini','check');24 % NXT_SetBrickName('Mindy', handle);23 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 24 %+ NXT_SetBrickName('Mindy', handle); 25 25 % 26 26 % See also: COM_GetDefaultNXT, NXT_SendKeepAlive, NXT_GetBatteryLevel … … 31 31 % Copyright: 2007-2008, RWTH Aachen University 32 32 % 33 ; 33 34 % 34 35 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_SetInputMode.m
r201 r282 3 3 % 4 4 % Syntax 5 % status = NXT_SetInputMode(port, SensorTypeDesc, SensorModeDesc, ReplyMode)5 % |status = NXT_SetInputMode(port, SensorTypeDesc, SensorModeDesc, ReplyMode)| 6 6 % 7 % status = NXT_SetInputMode(port, SensorTypeDesc, SensorModeDesc, ReplyMode, handle)7 % |status = NXT_SetInputMode(port, SensorTypeDesc, SensorModeDesc, ReplyMode, handle)| 8 8 % 9 9 % Description 10 % status = NXT_SetInputMode(InputPort, SensorTypeDesc, SensorModeDesc, ReplyMode)sets mode,11 % configures and initializes the given sensor port to be ready to be read out. The value port12 % can be addressed by the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_413 % analog to the labeling on the NXT Brick. The value SensorTypeDescdetermines the sensor type.14 % See all valid types below. SensorModeDescrepresents the sensor mode. It specifies what mode15 % the .ScaledVal from NXT_GetInputValuesshould be. Valid parameters see below. By the16 % ReplyModeone can request an acknowledgement for the packet transmission. The two strings17 % 'reply' and 'dontreply' are valid. The return value statusindicates if an error occures10 % |status = NXT_SetInputMode(InputPort, SensorTypeDesc, SensorModeDesc, ReplyMode)| sets mode, 11 % configures and initializes the given sensor |port| to be ready to be read out. The value |port| 12 % can be addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| 13 % analog to the labeling on the NXT Brick. The value |SensorTypeDesc| determines the sensor type. 14 % See all valid types below. |SensorModeDesc| represents the sensor mode. It specifies what mode 15 % the |.ScaledVal| from |NXT_GetInputValues| should be. Valid parameters see below. By the 16 % |ReplyMode| one can request an acknowledgement for the packet transmission. The two strings 17 % |'reply'| and |'dontreply'| are valid. The return value |status| indicates if an error occures 18 18 % by the packet transmission. 19 19 % 20 % status = NXT_SetInputMode(InputPort, SensorTypeDesc, SensorModeDesc, ReplyMode, handle)21 % uses the given NXT connection handle. This should be a struct containing a serial handle on a PC system and20 % |status = NXT_SetInputMode(InputPort, SensorTypeDesc, SensorModeDesc, ReplyMode, handle)| 21 % uses the given NXT connection |handle|. This should be a struct containing a serial handle on a PC system and 22 22 % a file handle on a Linux system. 23 23 % 24 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.24 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 25 25 % 26 26 % Input: 27 % * SensorTypeDesc:* Valid types are (all strings):27 % *|SensorTypeDesc|:* Valid types are (all strings): 28 28 % 29 % NO_SENSOR(nothing, use to close sensor port)29 % |NO_SENSOR| (nothing, use to close sensor port) 30 30 % 31 % SWITCH(NXT touch sensor, "binary")31 % |SWITCH| (NXT touch sensor, "binary") 32 32 % 33 % LIGHT_ACTIVE(NXT light sensor, red LED is on)33 % |LIGHT_ACTIVE| (NXT light sensor, red LED is on) 34 34 % 35 % LIGHT_INACTIVE(NXT light sensor, red LED is off)35 % |LIGHT_INACTIVE| (NXT light sensor, red LED is off) 36 36 % 37 % SOUND_DB(NXT sound sensor, unit dB)37 % |SOUND_DB| (NXT sound sensor, unit dB) 38 38 % 39 % SOUND_DBA(NXT sound sensor, unit dBA)39 % |SOUND_DBA| (NXT sound sensor, unit dBA) 40 40 % 41 % LOWSPEED(NXT, passive digital sensor)41 % |LOWSPEED| (NXT, passive digital sensor) 42 42 % 43 % LOWSPEED_9V(NXT, active digital sensor, e.g. UltraSonic)43 % |LOWSPEED_9V| (NXT, active digital sensor, e.g. UltraSonic) 44 44 % 45 % TEMPERATURE(old RCX sensor)45 % |TEMPERATURE| (old RCX sensor) 46 46 % 47 % REFLECTION(old RCX sensor)47 % |REFLECTION| (old RCX sensor) 48 48 % 49 % ANGLE(old RCX sensor)49 % |ANGLE| (old RCX sensor) 50 50 % 51 % CUSTOM(user defined)51 % |CUSTOM| (user defined) 52 52 % 53 53 % 54 % * SensorModeDesc:* Valid modes are (all strings):54 % *|SensorModeDesc|:* Valid modes are (all strings): 55 55 % 56 % RAWMODE(Fastest. RawADVal will be used)56 % |RAWMODE| (Fastest. RawADVal will be used) 57 57 % 58 % BOOLEANMODE(1 if above 45% threshold, else 0)58 % |BOOLEANMODE| (1 if above 45% threshold, else 0) 59 59 % 60 % TRANSITIONCNTMODE(count transitions of booleanmode)60 % |TRANSITIONCNTMODE| (count transitions of booleanmode) 61 61 % 62 % PERIODCOUNTERMODE(counr periods (up and down62 % |PERIODCOUNTERMODE| (counr periods (up and down 63 63 % transition) of boolean mode) 64 64 % 65 % PCTFULLSCALEMODE(normalized percentage between 065 % |PCTFULLSCALEMODE| (normalized percentage between 0 66 66 % and 100, use .NormalizedADVal 67 67 % instead!) … … 69 69 % 70 70 % More exotic modes are: 71 % CELSIUSMODE(RCX temperature only)71 % |CELSIUSMODE| (RCX temperature only) 72 72 % 73 % FAHRENHEITMODE(RCX temperature only)73 % |FAHRENHEITMODE| (RCX temperature only) 74 74 % 75 % ANGLESTEPSMODE(RCX rotation only)75 % |ANGLESTEPSMODE| (RCX rotation only) 76 76 % 77 % SLOPEMASK(what's this???)77 % |SLOPEMASK| (what's this???) 78 78 % 79 % MODEMASK(what's this???)79 % |MODEMASK| (what's this???) 80 80 % 81 81 % … … 83 83 % 84 84 % Examples 85 % status = NXT_SetInputMode(SENSOR_1, 'SOUND_DB', 'RAWMODE', 'dontreply');85 %+ status = NXT_SetInputMode(SENSOR_1, 'SOUND_DB', 'RAWMODE', 'dontreply'); 86 86 % 87 % handle = COM_OpenNXT('bluetooth.ini','check');88 % status = NXT_SetInputMode(SENSOR_3, 'LIGHT_ACTIVE', 'RAWMODE', 'dontreply', handle);87 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 88 %+ status = NXT_SetInputMode(SENSOR_3, 'LIGHT_ACTIVE', 'RAWMODE', 'dontreply', handle); 89 89 % 90 90 % See also: NXT_GetInputValues, OpenLight, OpenSound, OpenSwitch, OpenUltrasonic, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 95 95 % Copyright: 2007-2008, RWTH Aachen University 96 96 % 97 ; 97 98 % 98 99 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_SetOutputState.m
r252 r282 3 3 % 4 4 % Syntax 5 % status = NXT_SetOutputState(port, power, IsMotorOn, IsBrake, RegModeName, TurnRatio, RunStateName, TachoLimit, ReplyMode)5 % |status = NXT_SetOutputState(port, power, IsMotorOn, IsBrake, RegModeName, TurnRatio, RunStateName, TachoLimit, ReplyMode)| 6 6 % 7 % status = NXT_SetOutputState(port, power, IsMotorOn, IsBrake, RegModeName, TurnRatio, RunStateName, TachoLimit, ReplyMode, handle)7 % |status = NXT_SetOutputState(port, power, IsMotorOn, IsBrake, RegModeName, TurnRatio, RunStateName, TachoLimit, ReplyMode, handle)| 8 8 % 9 9 % Description 10 % status = NXT_SetOutputState(OutputPorts, Power, IsMotorOn, IsBrake, RegModeName, TurnRatio,11 % RunStateName, TachoLimit, ReplyMode) sends the given settings like motor port (MOTOR_A,12 % MOTOR_B or MOTOR_C), the power (-100...100, the IsMotorOn boolean flag, the IsBrake13 % boolean flag, the regulation mode name RegModeName ('IDLE', 'SYNC', 'SPEED'), the14 % TurnRatio (-100...100), the RunStateName ('IDLE', 'RUNNING', 'RAMUP', 'RAMPDOWN'),15 % the TachoLimit (angle limit) in degrees, and the ReplyMode. By the ReplyModeone can request16 % an acknowledgement for the packet transmission. The two strings 'reply' and 'dontreply'are17 % valid. The return value statusindicates if an error occures by the packet transmission.10 % |status = NXT_SetOutputState(OutputPorts, Power, IsMotorOn, IsBrake, RegModeName, TurnRatio, 11 % RunStateName, TachoLimit, ReplyMode)| sends the given settings like motor |port| (|MOTOR_A|, 12 % |MOTOR_B| or |MOTOR_C|), the |power| (|-100...100|, the |IsMotorOn| boolean flag, the |IsBrake| 13 % boolean flag, the regulation mode name |RegModeName| (|'IDLE'|, |'SYNC'|, |'SPEED'|), the 14 % |TurnRatio| (|-100...100|), the |RunStateName| (|'IDLE'|, |'RUNNING'|, |'RAMUP'|, |'RAMPDOWN'|), 15 % the |TachoLimit| (angle limit) in degrees, and the |ReplyMode|. By the |ReplyMode| one can request 16 % an acknowledgement for the packet transmission. The two strings |'reply'| and |'dontreply'| are 17 % valid. The return value |status| indicates if an error occures by the packet transmission. 18 18 % 19 % status = NXT_SetOutputState(OutputPorts, Power, IsMotorOn, IsBrake, RegModeName, TurnRatio,20 % RunStateName, TachoLimit, ReplyMode, handle) uses the given NXT connection handle.19 % |status = NXT_SetOutputState(OutputPorts, Power, IsMotorOn, IsBrake, RegModeName, TurnRatio, 20 % RunStateName, TachoLimit, ReplyMode, handle)| uses the given NXT connection |handle|. 21 21 % This should be a serial handle on a PC system and a file handle on a Linux system. 22 22 % 23 23 % Example 24 % NXT_SetOutputState(MOTOR_A,80,1,1,'SPEED',0,'RUNNING',360,'dontreply');24 %+ NXT_SetOutputState(MOTOR_A,80,1,1,'SPEED',0,'RUNNING',360,'dontreply'); 25 25 % 26 26 % See also: SendMotorSettings, NXT_GetOutputState, GetMotorSettings, MOTOR_A, MOTOR_B, MOTOR_C … … 31 31 % Copyright: 2007-2008, RWTH Aachen University 32 32 % 33 ; 33 34 % 34 35 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_StartProgram.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_StartProgram(filename)5 % |NXT_StartProgram(filename)| 6 6 % 7 % NXT_StartProgram(filename, handle)7 % |NXT_StartProgram(filename, handle)| 8 8 % 9 9 % Description 10 % NXT_StartProgram(filename)starts the embedded NXT Brick program determined by the string11 % filename. The maximum length is limited to 15 characters. The file12 % extension '.rxe'is added automatically if it was omitted.10 % |NXT_StartProgram(filename)| starts the embedded NXT Brick program determined by the string 11 % |filename|. The maximum length is limited to 15 characters. The file 12 % extension |'.rxe'| is added automatically if it was omitted. 13 13 % 14 % NXT_SetBrickName(name, handle) uses the given NXT connection handle. This should be14 % |NXT_SetBrickName(name, handle)| uses the given NXT connection |handle|. This should be 15 15 % a struct containing a serial handle on a PC system and a file handle on a Linux system. 16 16 % 17 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.17 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 18 18 % 19 19 % For more details see the official LEGO Mindstorms communication protocol. 20 20 % 21 21 % Examples 22 % NXT_StartProgram('ResetCounter');22 %+ NXT_StartProgram('ResetCounter'); 23 23 % 24 % handle = COM_OpenNXT('bluetooth.ini','check');25 % NXT_StartProgram('Demo.rxe', handle);24 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 25 %+ NXT_StartProgram('Demo.rxe', handle); 26 26 % 27 27 % See also: NXT_StopProgram … … 32 32 % Copyright: 2007-2008, RWTH Aachen University 33 33 % 34 ; 34 35 % 35 36 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_StopProgram.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_StopProgram()5 % |NXT_StopProgram()| 6 6 % 7 % NXT_StopProgram(handle)7 % |NXT_StopProgram(handle)| 8 8 % 9 9 % Description 10 % NXT_StopProgram()stops the current running embedded NXT Brick program.10 % |NXT_StopProgram()| stops the current running embedded NXT Brick program. 11 11 % 12 % NXT_StopProgram(handle) uses the given NXT connection handle. This should be12 % |NXT_StopProgram(handle)| uses the given NXT connection |handle|. This should be 13 13 % a struct containing a serial handle on a PC system and a file handle on a Linux system. 14 14 % 15 % If no Bluetooth handle is specified the default one ( COM_GetDefaultNXT) is used.15 % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. 16 16 % 17 17 % For more details see the official LEGO Mindstorms communication protocol. 18 18 % 19 19 % Examples 20 % NXT_StopProgram();20 %+ NXT_StopProgram(); 21 21 % 22 % handle = COM_OpenNXT('bluetooth.ini','check');23 % NXT_StopProgram(handle);22 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 23 %+ NXT_StopProgram(handle); 24 24 % 25 25 % See also: NXT_StartProgram … … 30 30 % Copyright: 2007-2008, RWTH Aachen University 31 31 % 32 ; 32 33 % 33 34 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_StopSoundPlayback.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_StopSoundPlayback()5 % |NXT_StopSoundPlayback()| 6 6 % 7 % NXT_StopSoundPlayback(handle)7 % |NXT_StopSoundPlayback(handle)| 8 8 % 9 9 % Description 10 % NXT_StopSoundPlayback()stops the current sound playback.10 % |NXT_StopSoundPlayback()| stops the current sound playback. 11 11 % 12 % NXT_StopSoundPlayback(handle)sends the stop sound playback command over the specific13 % Bluetooth handle(serial handle (PC) / file handle (Linux)).12 % |NXT_StopSoundPlayback(handle)| sends the stop sound playback command over the specific 13 % Bluetooth |handle| (serial handle (PC) / file handle (Linux)). 14 14 % 15 % If no NXT handle is specified the default one (COM_GetDefaultNXT) is used.15 % If no NXT |handle| is specified the default one (|COM_GetDefaultNXT|) is used. 16 16 % 17 17 % For more details see the official LEGO Mindstorms communication protocol. 18 18 % 19 19 % Examples 20 % NXT_StopSoundPlayback();20 %+ NXT_StopSoundPlayback(); 21 21 % 22 % handle = COM_OpenNXT('bluetooth.ini','check');23 % NXT_StopSoundPlayback(handle);22 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 23 %+ NXT_StopSoundPlayback(handle); 24 24 % 25 25 % See also: NXT_PlaySoundFile, NXT_PlayTone, COM_GetDefaultNXT … … 30 30 % Copyright: 2007-2008, RWTH Aachen University 31 31 % 32 ; 32 33 % 33 34 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/NXT_WriteIOMap.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXT_WriteIOMap(mod_id, offset, n_bytes, data)5 % |NXT_WriteIOMap(mod_id, offset, n_bytes, data)| 6 6 % 7 % NXT_WriteIOMap(mod_id, offset, n_bytes, data, handle)7 % |NXT_WriteIOMap(mod_id, offset, n_bytes, data, handle)| 8 8 % 9 9 % Description 10 % NXT_WriteIOMap(mod_id, offset, n_bytes, data) write the data bytes to the given module ID (mod_id).11 % The total number of bytes is given by n_bytes. The offsetparameter determines the index10 % |NXT_WriteIOMap(mod_id, offset, n_bytes, data)| write the data |bytes| to the given module ID (|mod_id|). 11 % The total number of bytes is given by |n_bytes|. The |offset| parameter determines the index 12 12 % position of the first byte. 13 13 % 14 % NXT_WriteIOMap(mod_id, offset, n_bytes, data, handle)sends the IO map write command15 % over the specific NXT handle handle(e.g. serial handle (PC) / file handle (Linux)).14 % |NXT_WriteIOMap(mod_id, offset, n_bytes, data, handle)| sends the IO map write command 15 % over the specific NXT handle |handle| (e.g. serial handle (PC) / file handle (Linux)). 16 16 % 17 % If no NXT handle is specified the default one (COM_GetDefaultNXT)is used.17 % If no NXT |handle| is specified the default one (|COM_GetDefaultNXT)| is used. 18 18 % 19 19 % For more details see the official LEGO Mindstorms communication protocol. 20 20 % 21 21 % Examples 22 % OutputModuleID = 13107323 % NXT_WriteIOMap(OutputModuleID, 0, 30, bytes;22 %+ OutputModuleID = 131073 23 %+ NXT_WriteIOMap(OutputModuleID, 0, 30, bytes; 24 24 % 25 % handle = COM_OpenNXT('bluetooth.ini','check');26 % OutputModuleID = 13107327 % NXT_WriteIOMap(OutputModuleID, 0, 30, bytes, handle);25 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 26 %+ OutputModuleID = 131073 27 %+ NXT_WriteIOMap(OutputModuleID, 0, 30, bytes, handle); 28 28 % 29 29 % See also: NXT_ReadIOMap, COM_GetDefaultNXT … … 34 34 % Copyright: 2007-2008, RWTH Aachen University 35 35 % 36 ; 36 37 % 37 38 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/OpenLight.m
r201 r282 3 3 % 4 4 % Syntax 5 % OpenLight(port, mode)5 % |OpenLight(port, mode)| 6 6 % 7 7 % Description 8 % OpenLight(port, mode)initializes the input mode of NXT light sensor specified by the sensor9 % port and the light mode. The value portcan be addressed by the symbolic constants10 % SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick. The11 % mode represents one of two modes 'ACTIVE' (active illumination: red light on) and 'INACTIVE'8 % |OpenLight(port, mode)| initializes the input mode of NXT light sensor specified by the sensor 9 % |port| and the light |mode|. The value |port| can be addressed by the symbolic constants 10 % |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. The 11 % |mode| represents one of two modes |'ACTIVE'| (active illumination: red light on) and |'INACTIVE'| 12 12 % (passive illumination red light off). To deactive the active illumination the function 13 % CloseSensoris used.13 % |CloseSensor| is used. 14 14 % 15 % For more complex settings the function NXT_SetInputModecan be used.15 % For more complex settings the function |NXT_SetInputMode| can be used. 16 16 % 17 17 % Example 18 % OpenLight(SENSOR_1, 'ACTIVE');19 % light = GetLight(SENSOR_1);20 % CloseSensor(SENSOR_1);18 %+ OpenLight(SENSOR_1, 'ACTIVE'); 19 %+ light = GetLight(SENSOR_1); 20 %+ CloseSensor(SENSOR_1); 21 21 % 22 22 % See also: NXT_SetInputMode, CloseSensor, GetLight, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/OpenSound.m
r201 r282 3 3 % 4 4 % Syntax 5 % OpenSound(port, mode)5 % |OpenSound(port, mode)| 6 6 % 7 7 % Description 8 % OpenSound(port, mode)initializes the input mode of NXT sound sensor specified by the sensor9 % port and the sound mode. The value portcan be addressed by the symbolic constants10 % SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick. The11 % mode represents one of two modes 'DB' (dB measurement) and 'DBA'(dBA measurement)8 % |OpenSound(port, mode)| initializes the input mode of NXT sound sensor specified by the sensor 9 % |port| and the sound |mode|. The value |port| can be addressed by the symbolic constants 10 % |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. The 11 % |mode| represents one of two modes |'DB'| (dB measurement) and |'DBA'| (dBA measurement) 12 12 % 13 % For more complex settings the function NXT_SetInputModecan be used.13 % For more complex settings the function |NXT_SetInputMode| can be used. 14 14 % 15 15 % Examples 16 % OpenSound(SENSOR_1, 'DB');17 % sound = GetSound(SENSOR_1);18 % CloseSensor(SENSOR_1);16 %+ OpenSound(SENSOR_1, 'DB'); 17 %+ sound = GetSound(SENSOR_1); 18 %+ CloseSensor(SENSOR_1); 19 19 % 20 20 % See also: NXT_SetInputMode, GetSound, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 25 25 % Copyright: 2007-2008, RWTH Aachen University 26 26 % 27 ; 27 28 % 28 29 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/OpenSwitch.m
r201 r282 3 3 % 4 4 % Syntax 5 % OpenSwitch(port)5 % |OpenSwitch(port)| 6 6 % 7 7 % Description 8 % OpenSound(port)initializes the input mode of NXT switch / touch sensor specified by the sensor9 % port. The value portcan be addressed by the symbolic constants10 % SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick.8 % |OpenSound(port)| initializes the input mode of NXT switch / touch sensor specified by the sensor 9 % |port|. The value |port| can be addressed by the symbolic constants 10 % |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. 11 11 % 12 % For more complex settings the function NXT_SetInputModecan be used.12 % For more complex settings the function |NXT_SetInputMode| can be used. 13 13 % 14 14 % Example 15 % OpenSwitch(SENSOR_4);16 % switchState = GetSwitch(SENSOR_4);17 % CloseSensor(SENSOR_4);15 %+ OpenSwitch(SENSOR_4); 16 %+ switchState = GetSwitch(SENSOR_4); 17 %+ CloseSensor(SENSOR_4); 18 18 % 19 19 % See also: NXT_SetInputMode, GetSwitch, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 … … 24 24 % Copyright: 2007-2008, RWTH Aachen University 25 25 % 26 ; 26 27 % 27 28 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/OpenUltrasonic.m
r201 r282 3 3 % 4 4 % Syntax 5 % OpenUltrasonic(port)5 % |OpenUltrasonic(port)| 6 6 % 7 % OpenUltrasonic(port, mode)7 % |OpenUltrasonic(port, mode)| 8 8 % 9 9 % Description 10 % OpenUltrasonic(port)initializes the input mode of NXT uktrasonic sensor specified by the sensor11 % port. The value portcan be addressed by the symbolic constants12 % SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4analog to the labeling on the NXT Brick.10 % |OpenUltrasonic(port)| initializes the input mode of NXT uktrasonic sensor specified by the sensor 11 % |port|. The value |port| can be addressed by the symbolic constants 12 % |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. 13 13 % 14 % OpenUltrasonic(port, mode) can enable the snapshot mode if the value modeis equal to the string15 % 'snapshot'. This mode provides the snap shot mode (or SINGLE_SHOT mode) of the NXT ultrasonic sensor,14 % |OpenUltrasonic(port, mode)| can enable the snapshot mode if the value |mode| is equal to the string 15 % |'snapshot'|. This mode provides the snap shot mode (or SINGLE_SHOT mode) of the NXT ultrasonic sensor, 16 16 % which provides several sensor readings in one step. See 17 % USMakeSnapshotfor more information.17 % |USMakeSnapshot| for more information. 18 18 % 19 19 % Since the NXT ultrasonic sensor is a digital sensor (that uses the I²C protocol), 20 % the function NXT_SetInputModecannot be used as for analog sensors.20 % the function |NXT_SetInputMode| cannot be used as for analog sensors. 21 21 % 22 22 % Note: When the US sensor is opened in snapshot mode, the function 23 % GetUltrasonicdoes not work correctly!23 % |GetUltrasonic| does not work correctly! 24 24 % 25 25 % 26 26 % Examples 27 % OpenUltrasonic(SENSOR_4);28 % distance = GetUltrasonic(SENSOR_4);29 % CloseSensor(SENSOR_4);27 %+ OpenUltrasonic(SENSOR_4); 28 %+ distance = GetUltrasonic(SENSOR_4); 29 %+ CloseSensor(SENSOR_4); 30 30 % 31 % port = SENSOR_4;32 % OpenUltrasonic(port, 'snapshot');33 % % send out the ping34 % USMakeSnapshot(port);35 % % wait some time for the sound to travel36 % pause(0.1); % 100ms is probably too much, calculate using c_sound ;-)37 % % retrieve all the echos in 1 step38 % echos = USGetSnapshotResults(port);39 % CloseSensor(SENSOR_4);31 %+ port = SENSOR_4; 32 %+ OpenUltrasonic(port, 'snapshot'); 33 %+ % send out the ping 34 %+ USMakeSnapshot(port); 35 %+ % wait some time for the sound to travel 36 %+ pause(0.1); % 100ms is probably too much, calculate using c_sound ;-) 37 %+ % retrieve all the echos in 1 step 38 %+ echos = USGetSnapshotResults(port); 39 %+ CloseSensor(SENSOR_4); 40 40 % 41 41 % See also: GetUltrasonic, USMakeSnapshot, USGetSnapshotResults, CloseSensor … … 46 46 % Copyright: 2007-2008, RWTH Aachen University 47 47 % 48 ; 48 49 % 49 50 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/README
r201 r282 62 62 The the command "bluetooth-applet --singleton" can be run from the console. After this, the script 63 63 "btconnect" should work. 64 If you get the error message "Can't connect RFCOMM socket: Permission denied", try to remove the paired 65 device inside the bluetooth-applet to force a new authorization 64 66 65 67 -
branches/telle/RWTHMindstormsNXT-Lejos/README.txt
r201 r282 62 62 The the command "bluetooth-applet --singleton" can be run from the console. After this, the script 63 63 "btconnect" should work. 64 If you get the error message "Can't connect RFCOMM socket: Permission denied", try to remove the paired 65 device inside the bluetooth-applet to force a new authorization. 64 66 65 67 -
branches/telle/RWTHMindstormsNXT-Lejos/ResetMotorAngle.m
r247 r282 3 3 % 4 4 % Syntax 5 % ResetMotorAngle(port)5 % |ResetMotorAngle(port)| 6 6 % 7 % ResetMotorAngle(port, handle)7 % |ResetMotorAngle(port, handle)| 8 8 % 9 9 % Description 10 % ResetMotorAngle(port)resets the relative angle counter for the motor connected to the given11 % port. The value port can be addressed by the symbolic constants MOTOR_A, MOTOR_Band12 % MOTOR_Canalog to the labeling on the NXT Brick. The relative counter can be read by the13 % function GetMotorSettings.10 % |ResetMotorAngle(port)| resets the relative angle counter for the motor connected to the given 11 % |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A|, |MOTOR_B| and 12 % |MOTOR_C| analog to the labeling on the NXT Brick. The relative counter can be read by the 13 % function |GetMotorSettings|. 14 14 % 15 % ResetMotorAngle(port, handle) uses the given Bluetooth connection handle. This should be a15 % |ResetMotorAngle(port, handle)| uses the given Bluetooth connection |handle|. This should be a 16 16 % serial handle on a PC system and a file handle on a Linux system. 17 17 % 18 % If no NXT handle is specified the default one ( COM_GetDefaultNXT) is used.18 % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. 19 19 % 20 20 % Examples 21 % ResetMotorAngle(MOTOR_A);21 %+ ResetMotorAngle(MOTOR_A); 22 22 % 23 % handle = COM_OpenNXT('bluetooth.ini','check');24 % ResetMotorAngle(MOTOR_C, handle);23 %+ handle = COM_OpenNXT('bluetooth.ini','check'); 24 %+ ResetMotorAngle(MOTOR_C, handle); 25 25 % 26 26 % See also: NXT_ResetMotorPosition, GetMotorSettings, MOTOR_A, MOTOR_B, MOTOR_C, COM_GetDefaultNXT … … 31 31 % Copyright: 2007-2008, RWTH Aachen University 32 32 % 33 ; 33 34 % 34 35 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SENSOR_1.m
r201 r282 3 3 % 4 4 % Syntax 5 % port1 = SENSOR_1()5 % |port1 = SENSOR_1()| 6 6 % 7 7 % Description 8 % port1 = SENSOR_1() returns 0 as the value port1.8 % |port1 = SENSOR_1()| returns |0| as the value |port1|. 9 9 % 10 10 % Example 11 % port1 = SENSOR_1()12 % %result: >> port1 = 011 %+ port1 = SENSOR_1() 12 %+ %result: >> port1 = 0 13 13 % 14 14 % See also: SENSOR_2, SENSOR_3, SENSOR_4 … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SENSOR_2.m
r201 r282 3 3 % 4 4 % Syntax 5 % port2 = SENSOR_2()5 % |port2 = SENSOR_2()| 6 6 % 7 7 % Description 8 % port2 = SENSOR_2() returns 1 as the value port2.8 % |port2 = SENSOR_2()| returns |1| as the value |port2|. 9 9 % 10 10 % Example 11 % port2 = SENSOR_2()12 % %result: >> port2 = 111 %+ port2 = SENSOR_2() 12 %+ %result: >> port2 = 1 13 13 % 14 14 % See also: SENSOR_1, SENSOR_3, SENSOR_4 … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SENSOR_3.m
r201 r282 3 3 % 4 4 % Syntax 5 % port3 = SENSOR_3()5 % |port3 = SENSOR_3()| 6 6 % 7 7 % Description 8 % port3 = SENSOR_3() returns 2 as the value port3.8 % |port3 = SENSOR_3()| returns |2| as the value |port3|. 9 9 % 10 10 % Example 11 % port3 = SENSOR_3()12 % %result: >> port3 = 211 %+ port3 = SENSOR_3() 12 %+ %result: >> port3 = 2 13 13 % 14 14 % See also: SENSOR_1, SENSOR_2, SENSOR_4 … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SENSOR_4.m
r201 r282 3 3 % 4 4 % Syntax 5 % port4 = SENSOR_4()5 % |port4 = SENSOR_4()| 6 6 % 7 7 % Description 8 % port4 = SENSOR_4() returns 3 as the value port4.8 % |port4 = SENSOR_4()| returns |3| as the value |port4|. 9 9 % 10 10 % Example 11 % port4 = SENSOR_4()12 % %result: >> port4 = 311 %+ port4 = SENSOR_4() 12 %+ %result: >> port4 = 3 13 13 % 14 14 % See also: SENSOR_1, SENSOR_2, SENSOR_3 … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SendMotorSettings.m
r248 r282 3 3 % 4 4 % Syntax 5 % SendMotorSettings()6 % 7 % SendMotorSettings(port, power, angle, speedRegulation, syncedToMotor, turnRatio, rampMode)5 % |SendMotorSettings()| 6 % 7 % |SendMotorSettings(port, power, angle, speedRegulation, syncedToMotor, turnRatio, rampMode)| 8 8 % 9 9 % Description 10 % SendMotorSettings()sends the previously specified settings of the current motor. The motor11 % settings are set by the functions SetMotor, SetPower, SetAngleLimit, SpeedRegulation,12 % SyncToMotor, SetTurnRatio and SetRampMode.13 % 14 % SendMotorSettings(port, power, angle, speedRegulation, syncedToMotor, turnRatio, rampMode)15 % sends the given settings like motor port (MOTOR_A, MOTOR_B or MOTOR_C), the power16 % ( -100...100, the angle limit, speedRegulation ('on', 'off'), syncedToMotor17 % ( MOTOR_A, MOTOR_B, MOTOR_C), turnRatio (-100...100) and rampMode ('off', 'up',18 % 'down').10 % |SendMotorSettings()| sends the previously specified settings of the current motor. The motor 11 % settings are set by the functions |SetMotor|, |SetPower|, |SetAngleLimit|, |SpeedRegulation|, 12 % |SyncToMotor|, |SetTurnRatio| and |SetRampMode|. 13 % 14 % |SendMotorSettings(port, power, angle, speedRegulation, syncedToMotor, turnRatio, rampMode)| 15 % sends the given settings like motor |port| (|MOTOR_A|, |MOTOR_B| or |MOTOR_C|), the |power| 16 % (|-100...100|, the |angle| limit, |speedRegulation| (|'on'|, |'off'|), |syncedToMotor| 17 % (|MOTOR_A|, |MOTOR_B|, |MOTOR_C|), |turnRatio| (|-100...100|) and |rampMode| (|'off'|, |'up'|, 18 % |'down'|). 19 19 % 20 20 % Note: … … 25 25 % 26 26 % Example 27 % SetMotor(MOTOR_B);28 % SyncToMotor(MOTOR_C);29 % SetPower(76);30 % SetAngleLimit(4*360);31 % SetTurnRatio(20);32 % SendMotorSettings();27 %+ SetMotor(MOTOR_B); 28 %+ SyncToMotor(MOTOR_C); 29 %+ SetPower(76); 30 %+ SetAngleLimit(4*360); 31 %+ SetTurnRatio(20); 32 %+ SendMotorSettings(); 33 33 % 34 34 % See also: GetMotorSettings, SetMotor, SetPower, SpeedRegulation, SyncToMotor, SetTurnRatio, SetRampMode, NXT_SetOutputState, MOTOR_A, MOTOR_B, MOTOR_C … … 39 39 % Copyright: 2007-2008, RWTH Aachen University 40 40 % 41 ; 41 42 % 42 43 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetAngleLimit.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetAngleLimit(limt)5 % |SetAngleLimit(limt)| 6 6 % 7 7 % Description 8 % SetAngleLimit(limt) sets the angle limit in degrees for the current motor, which is set by 9 % function SetMotor. This setting takes only affect with the next SendMotorSettings command. 8 % |SetAngleLimit(limt)| sets the angle |limit| in degrees for the current motor, which is set by 9 % function |SetMotor|. This setting takes only affect with the next |SendMotorSettings| command. 10 % 11 % Use |SetAngleLimit(0)| to deactivate this limit (hence the motor will run forever). 10 12 % 11 13 % Note: … … 18 20 % 19 21 % Example 20 % SetMotor(MOTOR_B);21 % SetPower(76);22 % SetAngleLimit(720);23 % SendMotorSettings();22 %+ SetMotor(MOTOR_B); 23 %+ SetPower(76); 24 %+ SetAngleLimit(720); 25 %+ SendMotorSettings(); 24 26 % 25 27 % See also: SendMotorSettings, SetMotor, GetMotor … … 30 32 % Copyright: 2007-2008, RWTH Aachen University 31 33 % 34 ; 32 35 % 33 36 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetMemoryCount.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetMemoryCount(port, angle)5 % |SetMemoryCount(port, angle)| 6 6 % 7 7 % Description 8 % SetMemoryCount(port, angle))sets the internal NXT memory counter (maual mapping replica)9 % of the given motor port. The value portcan be addressed by the symbolic constants10 % MOTOR_A, MOTOR_B and MOTOR_C analog to the labeling on the NXT Brick. The value angle8 % |SetMemoryCount(port, angle))| sets the internal NXT memory counter (maual mapping replica) 9 % of the given motor |port|. The value |port| can be addressed by the symbolic constants 10 % |MOTOR_A|, |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT Brick. The value |angle| 11 11 % sets the value of the NXT memory counter (maunal mapping replica). 12 12 % … … 15 15 % 16 16 % Example 17 % SetMemoryCount(MOTOR_B, 120);17 %+ SetMemoryCount(MOTOR_B, 120); 18 18 % 19 19 % See also: SetMemoryCounter, MOTOR_A, MOTOR_B, MOTOR_C … … 24 24 % Copyright: 2007-2008, RWTH Aachen University 25 25 % 26 ; 26 27 % 27 28 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetMotor.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetMotor(port)5 % |SetMotor(port)| 6 6 % 7 7 % Description 8 % SetMotor(port) sets the current motor on the given portas the current active motor which can be controlled9 % by SendMotorSettings. Changing motor settings take only an effect on the active motor. The10 % value port can be addressed by the symbolic constants MOTOR_A , MOTOR_B and MOTOR_C8 % |SetMotor(port)| sets the current motor on the given |port| as the current active motor which can be controlled 9 % by |SendMotorSettings|. Changing motor settings take only an effect on the active motor. The 10 % value |port| can be addressed by the symbolic constants |MOTOR_A| , |MOTOR_B| and |MOTOR_C| 11 11 % analog to the labeling on the NXT Brick. 12 12 % 13 % The current motor setting can be returned by function GetMotor.13 % The current motor setting can be returned by function |GetMotor|. 14 14 % 15 15 % Example 16 % SetMotor(MOTOR_C);17 % SetPower(76);18 % SetAngleLimit(720);19 % SendMotorSettings();16 %+ SetMotor(MOTOR_C); 17 %+ SetPower(76); 18 %+ SetAngleLimit(720); 19 %+ SendMotorSettings(); 20 20 % 21 21 % See also: GetMotor, SendMotorSettings, MOTOR_A, MOTOR_B, MOTOR_C … … 26 26 % Copyright: 2007-2008, RWTH Aachen University 27 27 % 28 ; 28 29 % 29 30 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetPower.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetPower(power)5 % |SetPower(power)| 6 6 % 7 7 % Description 8 % SetPower(power) sets the powervalue of the current active motor which can be controlled9 % by SendMotorSettings. The value powerhas to be an Integer value within the interval10 % -100...100. It specifies the percentage of the maximal available power. Negative values8 % |SetPower(power)| sets the |power| value of the current active motor which can be controlled 9 % by |SendMotorSettings|. The value |power| has to be an Integer value within the interval 10 % |-100...100|. It specifies the percentage of the maximal available power. Negative values 11 11 % indicates a reverse rotation direction. The power setting takes only affect with the next 12 % SendMotorSettingscommand.12 % |SendMotorSettings| command. 13 13 % 14 14 % Example 15 % SetMotor(MOTOR_B);16 % SetPower(-55);17 % SetAngleLimit(1200);18 % SendMotorSettings();15 %+ SetMotor(MOTOR_B); 16 %+ SetPower(-55); 17 %+ SetAngleLimit(1200); 18 %+ SendMotorSettings(); 19 19 % 20 20 % See also: SendMotorSettings, SetMotor … … 25 25 % Copyright: 2007-2008, RWTH Aachen University 26 26 % 27 ; 27 28 % 28 29 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetRampMode.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetRampMode(mode)5 % |SetRampMode(mode)| 6 6 % 7 7 % Description 8 % SetRampMode(mode) sets the ramp modeof the current active motor which can be controlled9 % by SendMotorSettings. The value mode can be either 'off', 'up' or 'down'. In the case10 % of 'off' no ramp up mode is used fo rthe current active motor. 'up'provides the motor to11 % accelerate from the current power speed to the next power speed set by SetPowerduring the12 % next rotation angle in degrees set by SetAngleLimit. 'down'provides a deceleration, respectively.13 % The mode setting takes only affect with the next SendMotorSettingscommand.8 % |SetRampMode(mode)| sets the ramp |mode| of the current active motor which can be controlled 9 % by |SendMotorSettings|. The value |mode| can be either |'off'|, |'up'| or |'down'|. In the case 10 % of |'off'| no ramp up mode is used fo rthe current active motor. |'up'| provides the motor to 11 % accelerate from the current power speed to the next power speed set by |SetPower| during the 12 % next rotation angle in degrees set by |SetAngleLimit|. |'down'| provides a deceleration, respectively. 13 % The |mode| setting takes only affect with the next |SendMotorSettings| command. 14 14 % 15 15 % Examples 16 % SetMotor(MOTOR_B);17 % SetPower(76);18 % SetAngleLimit(3600);19 % SetRampMode('up');20 % SendMotorSettings();16 %+ SetMotor(MOTOR_B); 17 %+ SetPower(76); 18 %+ SetAngleLimit(3600); 19 %+ SetRampMode('up'); 20 %+ SendMotorSettings(); 21 21 % 22 22 % See also: SendMotorSettings, SetPower, SetAngleLimit … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SetTurnRatio.m
r201 r282 3 3 % 4 4 % Syntax 5 % SetTurnRatio(ratio)5 % |SetTurnRatio(ratio)| 6 6 % 7 7 % Description 8 % SetTurnRatio(ratio) sets the turn ratioof the current active motor which can be controlled9 % by SendMotorSettings. The value ratio has to be wihtin the Integer interval -100...100.8 % |SetTurnRatio(ratio)| sets the turn |ratio| of the current active motor which can be controlled 9 % by |SendMotorSettings|. The value |ratio| has to be wihtin the Integer interval |-100...100|. 10 10 % The value specifies the ratio of power distribution between two motors (e.g. left and right 11 11 % wheel of the robot). 12 % The ratio setting takes only affect with the next SendMotorSettingscommand and if two13 % motors are synchronied with SyncToMotor.12 % The |ratio| setting takes only affect with the next |SendMotorSettings| command and if two 13 % motors are synchronied with |SyncToMotor|. 14 14 % 15 15 % According to the LEGO Mindstorms communication protocol documentation, a ratio of 0 means equal … … 20 20 % 21 21 % Note: 22 % When using several motor commands with SyncToMotorstatements,22 % When using several motor commands with |SyncToMotor| statements, 23 23 % unexpected behaviour can occur, due to the NXTs internal error correction counters. 24 % Sometimes it can help to issue the commands NXT_ResetMotorPosition(port, true),25 % NXT_ResetMotorPosition(port, false) and StopMotor(port, 'off')for each of both24 % Sometimes it can help to issue the commands |NXT_ResetMotorPosition(port, true)|, 25 % |NXT_ResetMotorPosition(port, false)| and |StopMotor(port, 'off')| for each of both 26 26 % motors. Although this seems like a waste of packets, this can do the trick, especially 27 27 % when working with certain turn ratios. 28 28 % 29 29 % Example 30 % SetMotor(MOTOR_B);31 % SyncToMotor(MOTOR_A);32 % SetPower(76);33 % SetTurnRatio(50);34 % SendMotorSettings();30 %+ SetMotor(MOTOR_B); 31 %+ SyncToMotor(MOTOR_A); 32 %+ SetPower(76); 33 %+ SetTurnRatio(50); 34 %+ SendMotorSettings(); 35 35 % 36 36 % See also: SendMotorSettings, SyncToMotor, SetMotor, SetPower … … 41 41 % Copyright: 2007-2008, RWTH Aachen University 42 42 % 43 ; 43 44 % 44 45 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SpeedRegulation.m
r201 r282 3 3 % 4 4 % Syntax 5 % SpeedRegulation(mode)5 % |SpeedRegulation(mode)| 6 6 % 7 7 % Description 8 % SpeedRegulation(mode)enables or disabled the speed regulation mode of the current active9 % motor which can be controlled by SendMotorSettings. The value mode can be equal to 'on'or10 % 'off'which enables or disables the speed regulation.11 % The speed regulation setting takes only affect with the next SendMotorSettingscommand.8 % |SpeedRegulation(mode)| enables or disabled the speed regulation mode of the current active 9 % motor which can be controlled by |SendMotorSettings|. The value |mode| can be equal to |'on'| or 10 % |'off'| which enables or disables the speed regulation. 11 % The speed regulation setting takes only affect with the next |SendMotorSettings| command. 12 12 % 13 13 % The speed regulation provides the motor to rotate speed controlled. So rotations at low speeds … … 20 20 % 21 21 % Example 22 % SetMotor(MOTOR_A);23 % SetPower(12);24 % SpeedRegulation('on');25 % SendMotorSettings();22 %+ SetMotor(MOTOR_A); 23 %+ SetPower(12); 24 %+ SpeedRegulation('on'); 25 %+ SendMotorSettings(); 26 26 % 27 27 % See also: SendMotorSettings, SetMotor, SetPower … … 32 32 % Copyright: 2007-2008, RWTH Aachen University 33 33 % 34 ; 34 35 % 35 36 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/StopMotor.m
r262 r282 3 3 % 4 4 % Syntax 5 % StopMotor(port, mode)5 % |StopMotor(port, mode)| 6 6 % 7 7 % Description 8 % StopMotor(ports, mode) stops the motor connected to the given ports. 9 % The value port can be addressed by a string representing the label(s) 8 % |StopMotor(ports, mode)| stops the motor connected to the given |ports|. 9 % The value |port| can be addressed by a string representing the label(s) 10 % addressed by the symbolic constants |MOTOR_A|, |MOTOR_B|, |MOTOR_C| and |'all'| (all motor at at 11 % the same time) analog to the labeling on the NXT Brick. The argument |mode| can be equal to 12 % |'off'| which cuts off the electrical power to the specific motor, so called "COAST" mode. The 13 10 14 % of the port on the brick ('A', 'B', 'C', or any combination) or the 11 15 % indexes of the ports starting with 0, i.e., 0, 1, or 2 correspond to A, 12 16 % B, and C respectively. The indexes may also be given as a string, e.g., 13 % '1'. If all motors shall be stopped the string 'all'can be used for17 % '1'. If all motors shall be stopped the string |'all'| can be used for 14 18 % the first argument. 15 19 % … … 23 27 % 24 28 % Note: 25 % The value port equal to 'all' can be used to stopp all motors at the 26 % same time using only one single Bluetooth packet. 29 % The value |port| equal to |'all'| can be used to stopp all motors at the 30 % same time using only one single Bluetooth packet. After a |StopMotor| 31 % command the motor snychronization will be lost. 27 32 % 28 % With mode equal to 'off', the motor will slowly stop spinning, but29 % using 'brake' applies real force to the motor to stand still at the30 % current position .33 % With |mode| equal to |'off'|, the motor will slowly stop spinning, but 34 % using |'brake'| applies real force to the motor to stand still at the 35 % current position, just like a real brake. 31 36 % 32 % When calling StopMotor(..., 'off'), internally the speed regulation33 % is turned off, while using 'brake' will enable speed regulation.37 % When calling |StopMotor(..., 'off')|, internally the speed regulation 38 % is turned off, while using |'brake'| will enable speed regulation. 34 39 % 35 40 % Example 36 % m = NXTmotor('A'); 37 % m.Power = -55; 38 % m.TachoLimit = 1200; 41 %+ SetMotor(MOTOR_B); 42 %+ SetPower(-55); 43 %+ SetAngleLimit(1200); 44 %+ SendMotorSettings(); 45 %+ 46 %+ WaitForMotor(MOTOR_A); 47 %+ 48 %+ StopMotor(MOTOR_B, 'brake'); 49 % 50 % Example (with use of NXTmotor object) 51 %+ m = NXTmotor('A'); 52 %+ m.Power = -55; 53 %+ m.TachoLimit = 1200; 54 %+ 55 %+ m2 = NXTmotor('B'); 56 %+ m2.Power = 60; 57 %+ 58 %+ send(m); 59 %+ send(m2); 60 %+ 61 %+ wait(m); 62 %+ 63 %+ StopMotor('all', 'brake'); 39 64 % 40 % m2 = NXTmotor('B'); 41 % m2.Power = 60; 65 % See also: WaitForMotor, SendMotorSettings, MOTOR_A, MOTOR_B, MOTOR_C, NXTmotor, NXTmotor/stop 42 66 % 43 % send(m);44 % send(m2);45 %46 % wait(m);47 %48 % StopMotor('all', 'brake');49 %50 % See also: NXTmotor, NXTmotor/STOP51 %52 53 67 % Signature 54 68 % Author: Aulis Telle, Linus Atorf, Alexander Behrens (see AUTHORS) … … 56 70 % Copyright: 2007-2008, RWTH Aachen University 57 71 % 72 ; 58 73 % 59 74 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SwitchLamp.m
r201 r282 3 3 % 4 4 % Syntax 5 % SwitchLamp(port, mode)5 % |SwitchLamp(port, mode)| 6 6 % 7 7 % Description 8 % SwitchLamp(port, mode)turns the LEGO lamp on or off.9 % The given port number specifies the used motor port. The value portcan be10 % addressed by the symbolic constants MOTOR_A , MOTOR_B and MOTOR_Canalog to11 % the labeling on the NXT Brick. The value mode supports two modes 'on' and 'off'to turn8 % |SwitchLamp(port, mode)| turns the LEGO lamp on or off. 9 % The given |port| number specifies the used motor port. The value |port| can be 10 % addressed by the symbolic constants |MOTOR_A| , |MOTOR_B| and |MOTOR_C| analog to 11 % the labeling on the NXT Brick. The value |mode| supports two modes |'on'| and |'off'| to turn 12 12 % the lamp on and off. 13 13 % … … 17 17 % full brightness (after a short while). 18 18 % 19 % A StopMotor command with parameter 'off'will also turn off the lamp, but it is19 % A |StopMotor| command with parameter |'off'| will also turn off the lamp, but it is 20 20 % recommended to use this function when working with lamps for better readability. 21 21 % 22 22 % Examples 23 % SwitchLamp(MOTOR_B, 'on');23 %+ |SwitchLamp(MOTOR_B, 'on');| 24 24 % 25 % SwitchLamp(MOTOR_A, 'off');25 %+ |SwitchLamp(MOTOR_A, 'off');| 26 26 % 27 27 % See also: SetPower, SendMotorSettings, StopMotor, MOTOR_A, MOTOR_B, MOTOR_C … … 32 32 % Copyright: 2007-2008, RWTH Aachen University 33 33 % 34 ; 34 35 % 35 36 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/SyncToMotor.m
r201 r282 3 3 % 4 4 % Syntax 5 % SyncToMotor(OtherMotor)5 % |SyncToMotor(OtherMotor)| 6 6 % 7 7 % Description 8 % SyncToMotor(OtherMotor)sets the synchronization mode to the curren active motor (set by9 % SetMotor) and the given motor port OtherMotor. The value OtherMotorcan be addressed by10 % the symbolic constants MOTOR_A , MOTOR_B and MOTOR_Canalog to the labeling on the NXT11 % Brick. The synchronization mode can be set off if the value OtherMotoris set equal to12 % 'off'. The synchronization setting takes only affect with the next SendMotorSettingscommand.8 % |SyncToMotor(OtherMotor)| sets the synchronization mode to the curren active motor (set by 9 % |SetMotor|) and the given motor port |OtherMotor|. The value |OtherMotor| can be addressed by 10 % the symbolic constants |MOTOR_A| , |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT 11 % Brick. The synchronization mode can be set off if the value |OtherMotor| is set equal to 12 % |'off'|. The synchronization setting takes only affect with the next |SendMotorSettings| command. 13 13 % 14 14 % This means that both motors will act as if they were connected through an axle. Motors with more … … 22 22 % settings set to it will be applied to both motors (until synchronisation is lost of course). 23 23 % Once 2 motors are synced, you effectively control 2 motors with 1 set of commands. This means, 24 % when calling SendMotorSettings, in fact 2 packets will be send to the 2 synced motors, hence24 % when calling |SendMotorSettings|, in fact 2 packets will be send to the 2 synced motors, hence 25 25 % you will experience about twice the lag than usual. Take this into consideration... 26 26 % 27 % When using several motor commands with SyncToMotorstatements,27 % When using several motor commands with |SyncToMotor| statements, 28 28 % unexpected behaviour can occur, due to the NXTs internal error correction counters. 29 % Sometimes it can help to issue the commands NXT_ResetMotorPosition(port, true),30 % NXT_ResetMotorPosition(port, false) and StopMotor(port, 'off')for each of both29 % Sometimes it can help to issue the commands |NXT_ResetMotorPosition(port, true)|, 30 % |NXT_ResetMotorPosition(port, false)| and |StopMotor(port, 'off')| for each of both 31 31 % motors. Although this seems like a waste of packets, this can do the trick, especially 32 % when working with certain turn ratios (see SetTurnRatio).32 % when working with certain turn ratios (see |SetTurnRatio|). 33 33 % 34 34 % Example 35 % SetMotor(MOTOR_B);36 % SyncToMotor(MOTOR_C);37 % SetPower(76);38 % SendMotorSettings();35 %+ SetMotor(MOTOR_B); 36 %+ SyncToMotor(MOTOR_C); 37 %+ SetPower(76); 38 %+ SendMotorSettings(); 39 39 % 40 40 % See also: SendMotorSettings, SetMotor, SetPower, SetTurnRatio … … 45 45 % Copyright: 2007-2008, RWTH Aachen University 46 46 % 47 ; 47 48 % 48 49 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/USGetSnapshotResults.m
r201 r282 3 3 % 4 4 % Syntax 5 % echos = USGetSnapshotResults(port)5 % |echos = USGetSnapshotResults(port)| 6 6 % 7 7 % Description 8 % echos = USGetSnapshotResults(port)retrieves the echos originating9 % from the ping that was sent out with USMakeSnapshot(port)for the ultrasonic10 % sensor connected to port. In order for this to work, the sensor has11 % to have been opened in snapshot mode using OpenUltrasonic(port, 'snapshot').8 % |echos = USGetSnapshotResults(port)| retrieves the echos originating 9 % from the ping that was sent out with |USMakeSnapshot(port)| for the ultrasonic 10 % sensor connected to |port|. In order for this to work, the sensor has 11 % to have been opened in snapshot mode using |OpenUltrasonic(port, 'snapshot')|. 12 12 % 13 % The vector echosalways contains exactly 8 readings for up to13 % The vector |echos| always contains exactly 8 readings for up to 14 14 % 8 echos that were recorded from one single signal. Depending on the 15 15 % structure and reflections, this can only be one valid echo, or a lot of 16 16 % interference. The values are distances, just as you'd expect from 17 % GetUltrasonic. The values are sorted in order of appearance, so they17 % |GetUltrasonic|. The values are sorted in order of appearance, so they 18 18 % should also be sorted with increasing distances. 19 19 % 20 20 % It is not known how exactly the measurements are to be interpreted! 21 21 % 22 % Please make sure that after calling USGetSnapshotResults, there is a22 % Please make sure that after calling |USGetSnapshotResults|, there is a 23 23 % little time period for the sound waves to travel, to be reflected, and 24 24 % be recorded by the sensor. You can estimate this using the speed of … … 26 26 % 27 27 % Note: When the US sensor is opened in snapshot mode, the function 28 % GetUltrasonicdoes not work correctly!28 % |GetUltrasonic| does not work correctly! 29 29 % 30 30 % Example 31 % port = SENSOR_4;32 % OpenUltrasonic(port, 'snapshot');33 % % send out the ping34 % USMakeSnapshot(port);35 % % wait some time for the sound to travel36 % pause(0.1); % 100ms is probably too much, calculate using c_sound ;-)37 % % retrieve all the echos in 1 step38 % echos = USGetSnapshotResults(port);39 % CloseSensor(SENSOR_4);31 %+ port = SENSOR_4; 32 %+ OpenUltrasonic(port, 'snapshot'); 33 %+ % send out the ping 34 %+ USMakeSnapshot(port); 35 %+ % wait some time for the sound to travel 36 %+ pause(0.1); % 100ms is probably too much, calculate using c_sound ;-) 37 %+ % retrieve all the echos in 1 step 38 %+ echos = USGetSnapshotResults(port); 39 %+ CloseSensor(SENSOR_4); 40 40 % 41 41 % See also: OpenUltrasonic, GetUltrasonic, USMakeSnapshot, CloseSensor … … 46 46 % Copyright: 2007-2008, RWTH Aachen University 47 47 % 48 ; 48 49 % 49 50 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/USMakeSnapshot.m
r201 r282 3 3 % 4 4 % Syntax 5 % USMakeSnapshot(port)5 % |USMakeSnapshot(port)| 6 6 % 7 7 % Description 8 % Call USMakeSnapshot(port)to make the specific ultrasonic sensor9 % connected to portsend out one single signal (called "ping"). In8 % Call |USMakeSnapshot(port)| to make the specific ultrasonic sensor 9 % connected to |port| send out one single signal (called "ping"). In 10 10 % contrast to the US sensor's continous mode (that is invoked by a normal 11 % OpenUltrasonic without the 'snapshot'parameter), the sensor will11 % |OpenUltrasonic| without the |'snapshot'| parameter), the sensor will 12 12 % only send out ultrasonic signals when this function is called. Up to 8 13 13 % multiple echos will be recorded, and the according distances stored in 14 % the sensor's internal memory. Use USGetSnapshotResultsto retrieve14 % the sensor's internal memory. Use |USGetSnapshotResults| to retrieve 15 15 % those 8 readings in one step! 16 16 % 17 17 % Note: When the US sensor is opened in snapshot mode, the function 18 % GetUltrasonicdoes not work correctly!18 % |GetUltrasonic| does not work correctly! 19 19 % 20 20 % Example 21 % port = SENSOR_4;22 % OpenUltrasonic(port, 'snapshot');23 % % send out the ping24 % USMakeSnapshot(port);25 % % wait some time for the sound to travel26 % pause(0.1); % 100ms is probably too much, calculate using c_sound ;-)27 % % retrieve all the echos in 1 step28 % echos = USGetSnapshotResults(port);29 % CloseSensor(SENSOR_4);21 %+ port = SENSOR_4; 22 %+ OpenUltrasonic(port, 'snapshot'); 23 %+ % send out the ping 24 %+ USMakeSnapshot(port); 25 %+ % wait some time for the sound to travel 26 %+ pause(0.1); % 100ms is probably too much, calculate using c_sound ;-) 27 %+ % retrieve all the echos in 1 step 28 %+ echos = USGetSnapshotResults(port); 29 %+ CloseSensor(SENSOR_4); 30 30 % 31 31 % See also: OpenUltrasonic, GetUltrasonic, USGetSnapshotResults, CloseSensor … … 36 36 % Copyright: 2007-2008, RWTH Aachen University 37 37 % 38 ; 38 39 % 39 40 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/WaitForMotor.m
r201 r282 3 3 % 4 4 % Syntax 5 % WaitForMotor(port)5 % |WaitForMotor(port)| 6 6 % 7 % WaitForMotor(port, time)7 % |WaitForMotor(port, time)| 8 8 % 9 9 % Description 10 % WaitForMotor(port)pauses other MALTAB executions until the motor connected to the given11 % port is not running anymore. The value portcan be addressed by the symbolic constants12 % MOTOR_A, MOTOR_B and MOTOR_Canalog to the labeling on the NXT Brick.10 % |WaitForMotor(port)| pauses other MALTAB executions until the motor connected to the given 11 % |port| is not running anymore. The value |port| can be addressed by the symbolic constants 12 % |MOTOR_A|, |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT Brick. 13 13 % 14 % WaitForMotor(port, time)specifies a maximum timeout (waiting time in seconds) until14 % |WaitForMotor(port, time)| specifies a maximum timeout (waiting time in seconds) until 15 15 % execution will be continued anyway 16 16 % … … 24 24 % slightly later than expected (depending on Bluetooth connection 25 25 % quality). Be aware of this (for example by setting an angle limit using 26 % SetAngleLimit) to take precautions.26 % |SetAngleLimit|) to take precautions. 27 27 % 28 28 % Example 29 % SetMotor(MOTOR_B);30 % SetPower(-55);31 % SetAngleLimit(1200);32 % SendMotorSettings();33 % 34 % WaitForMotor(MOTOR_A);35 % 36 % StopMotor(MOTOR_B, 'brake');29 %+ SetMotor(MOTOR_B); 30 %+ SetPower(-55); 31 %+ SetAngleLimit(1200); 32 %+ SendMotorSettings(); 33 %+ 34 %+ WaitForMotor(MOTOR_A); 35 %+ 36 %+ StopMotor(MOTOR_B, 'brake'); 37 37 % 38 38 % See also: SendMotorSettings, StopMotor, MOTOR_A, MOTOR_B, MOTOR_C … … 43 43 % Copyright: 2007-2008, RWTH Aachen University 44 44 % 45 ; 45 46 % 46 47 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/checkStatusByte.m
r201 r282 3 3 % 4 4 % Syntax 5 % [flag err_message] = checkStatusByte(response)5 % |[flag err_message] = checkStatusByte(response)| 6 6 % 7 7 % Description 8 % [flag err_message] = checkStatusByte(response) interpretes the responsebyte (not9 % hexadecimal). The return value flagindicates wether an error has occured10 % ( true = error, false = success). The string value err_messagecontains8 % |[flag err_message] = checkStatusByte(response)| interpretes the |response| byte (not 9 % hexadecimal). The return value |flag| indicates wether an error has occured 10 % (|true| = error, |false| = success). The string value |err_message| contains 11 11 % the error message (or '' in case of success). 12 12 % 13 13 % Example 14 % [status SleepTimeLimit] = NXT_SendKeepAlive('reply');15 % [err errmsg] = checkStatusByte(status);14 %+ [status SleepTimeLimit] = NXT_SendKeepAlive('reply'); 15 %+ [err errmsg] = checkStatusByte(status); 16 16 % 17 17 % See also: COM_CollectPacket, NXT_LSGetStatus … … 22 22 % Copyright: 2007-2008, RWTH Aachen University 23 23 % 24 ; 24 25 % 25 26 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/byte2outputmode.m
r201 r282 3 3 % 4 4 % Syntax 5 % [isMOTORON isBRAKE isREGULATED] = byte2outputmode(byte)5 % |[isMOTORON isBRAKE isREGULATED] = byte2outputmode(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/byte2regmode.m
r201 r282 3 3 % 4 4 % Syntax 5 % name = byte2regmode(byte)5 % |name = byte2regmode(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/byte2runstate.m
r201 r282 3 3 % 4 4 % Syntax 5 % name = byte2runstate(byte)5 % |name = byte2runstate(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/byte2sensormode.m
r201 r282 3 3 % 4 4 % Syntax 5 % name = byte2sensormode(byte)5 % |name = byte2sensormode(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/byte2sensortype.m
r201 r282 3 3 % 4 4 % Syntax 5 % name = byte2sensortype(byte)5 % |name = byte2sensortype(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/checkHandleStruct.m
r247 r282 18 18 % Date: 2008/07/01 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 ; 20 21 % 21 22 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/commandbyte2name.m
r201 r282 3 3 % 4 4 % Syntax 5 % name = commandbyte2name(byte)5 % |name = commandbyte2name(byte)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/createHandleStruct.m
r247 r282 34 34 % Date: 2008/07/01 35 35 % Copyright: 2007-2008, RWTH Aachen University 36 ; 36 37 % 37 38 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/dec2wordbytes.m
r201 r282 3 3 % 4 4 % Syntax 5 % bytes = dec2wordbytes(val, n, varargin)5 % |bytes = dec2wordbytes(val, n, varargin)| 6 6 % 7 7 % Description … … 22 22 % Copyright: 2007-2008, RWTH Aachen University 23 23 % 24 ; 24 25 % 25 26 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/fantom_proto.m
r201 r282 16 16 % Date: 2008/03/29 17 17 % Copyright: 2007-2008, RWTH Aachen University 18 ; 18 19 % 19 20 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/getReplyLengthFromCmdByte.m
r201 r282 3 3 % 4 4 % Syntax 5 % len = getReplyLengthFromCmdByte(byte)5 % |len = getReplyLengthFromCmdByte(byte)| 6 6 % 7 7 % Description … … 19 19 % Copyright: 2007-2008, RWTH Aachen University 20 20 % 21 ; 21 22 % 22 23 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/getVISAErrorString.m
r201 r282 3 3 % 4 4 % Syntax 5 % errorstring=getVISAErrorString(commandstatus)5 % |errorstring=getVISAErrorString(commandstatus)| 6 6 % 7 7 % Description … … 20 20 % Copyright: 2007-2008, RWTH Aachen University 21 21 % 22 ; 22 23 % 23 24 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/initializeGlobalMotorStateVar.m
r201 r282 3 3 % 4 4 % Syntax 5 % NXTMOTOR_State = initializeGlobalMotorStateVar5 % |NXTMOTOR_State = initializeGlobalMotorStateVar| 6 6 % 7 7 % Description … … 16 16 % Copyright: 2007-2008, RWTH Aachen University 17 17 % 18 ; 18 19 % 19 20 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/isdebug.m
r201 r282 3 3 % 4 4 % Syntax 5 % ret = isdebug;5 % |ret = isdebug;| 6 6 % 7 7 % Description 8 % Used as a fast alternative to strcmpi(DebugMode(), 'on'), this function9 % returns true if the current debug state for textOut() is 'on', and false10 % if it is 'off'.8 % Used as a fast alternative to |strcmpi(DebugMode(), 'on')|, this function 9 % returns |true| if the current debug state for |textOut()| is |'on'|, and |false| 10 % if it is |'off'|. 11 11 % 12 12 % Since string handling takes CPU time, sometimes you might want to omit 13 13 % generating large or complex debug messages that would be discarded anyway. You 14 % can check this by putting an if isdebug before the actual textOut14 % can check this by putting an |if isdebug| before the actual |textOut| 15 15 % statement. 16 16 % 17 % Note: isdebug can return [] if textOut()has never been called before.18 % This is not a problem, since if isdebugstill works like expected. Be17 % Note: isdebug can return |[]| if |textOut()| has never been called before. 18 % This is not a problem, since |if isdebug| still works like expected. Be 19 19 % careful though! 20 20 % 21 21 % Example 22 % if isdebug23 % % only generate this debug message if it will be displayed24 % textOut(sprintf('Current packet: %s \n', ...25 % horzcat(dec2hex(Packet, 2), blanks(length(Packet))')'));26 % end%if22 %+ if isdebug 23 %+ % only generate this debug message if it will be displayed 24 %+ textOut(sprintf('Current packet: %s \n', ... 25 %+ horzcat(dec2hex(Packet, 2), blanks(length(Packet))')')); 26 %+ end%if 27 27 % 28 28 % See also: textOut, DebugMode … … 33 33 % Copyright: 2007-2008, RWTH Aachen University 34 34 % 35 ; 35 36 % 36 37 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/libusb_proto.m
r201 r282 16 16 % Date: 2008/04/29 17 17 % Copyright: 2007-2008, RWTH Aachen University 18 ; 18 19 % 19 20 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/name2commandbytes.m
r201 r282 3 3 % 4 4 % Syntax 5 % [type cmd bytes] = name2commandbytes(name)5 % |[type cmd bytes] = name2commandbytes(name)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/outputmode2byte.m
r201 r282 3 3 % 4 4 % Syntax 5 % byte = outputmode2byte(varargin)5 % |byte = outputmode2byte(varargin)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/regmode2byte.m
r201 r282 3 3 % 4 4 % Syntax 5 % byte = regmode2byte(name)5 % |byte = regmode2byte(name)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/runstate2byte.m
r201 r282 3 3 % 4 4 % Syntax 5 % byte = runstate2byte(name)5 % |byte = runstate2byte(name)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/sensormode2byte.m
r201 r282 3 3 % 4 4 % Syntax 5 % byte = sensormode2byte(name)5 % |byte = sensormode2byte(name)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/sensortype2byte.m
r201 r282 3 3 % 4 4 % Syntax 5 % byte = sensortype2byte(name)5 % |byte = sensortype2byte(name)| 6 6 % 7 7 % Description … … 14 14 % Copyright: 2007-2008, RWTH Aachen University 15 15 % 16 ; 16 17 % 17 18 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/private/wordbytes2dec.m
r201 r282 3 3 % 4 4 % Syntax 5 % res = wordbytes2dec(bytes, n, varargin)5 % |res = wordbytes2dec(bytes, n, varargin)| 6 6 % 7 7 % Description … … 21 21 % Copyright: 2007-2008, RWTH Aachen University 22 22 % 23 ; 23 24 % 24 25 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/readFromIniFile.m
r201 r282 3 3 % 4 4 % Syntax 5 % ret = readFromIniFile(AppName, KeyName, filename)5 % |ret = readFromIniFile(AppName, KeyName, filename)| 6 6 % 7 7 % Description … … 27 27 % 28 28 % Examples: 29 % %a sample ini file (sample.ini) may have entries:30 % %31 % % [XYZ]32 % % abc=12333 % % def=734 % % ; lines starting with a ; are comments35 % % [ZZZ]36 % % abc=89029 %+ %a sample ini file (sample.ini) may have entries: 30 %+ % 31 %+ % [XYZ] 32 %+ % abc=123 33 %+ % def=7 34 %+ % ; lines starting with a ; are comments 35 %+ % [ZZZ] 36 %+ % abc=890 37 37 % 38 % readFromIniFile('XYZ','abc', 'sample.ini') % will return '123'38 %+ readFromIniFile('XYZ','abc', 'sample.ini') % will return '123' 39 39 % 40 % readFromIniFile('ZZZ','abc', 'sample.ini') % will return '890'40 %+ readFromIniFile('ZZZ','abc', 'sample.ini') % will return '890' 41 41 % 42 % readFromIniFile('XYZ','def', 'sample.ini') % will return '7'42 %+ readFromIniFile('XYZ','def', 'sample.ini') % will return '7' 43 43 % 44 44 % Signature … … 47 47 % Copyright: 2007-2008, RWTH Aachen University 48 48 % 49 ; 49 50 % 50 51 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/textOut.m
r201 r282 3 3 % 4 4 % Syntax 5 % textOut(strMsg)5 % |textOut(strMsg)| 6 6 % 7 % textOut(strMsg, 'screenonly')7 % |textOut(strMsg, 'screenonly')| 8 8 % 9 % textOut(strMsg, 'logonly')9 % |textOut(strMsg, 'logonly')| 10 10 % 11 11 % Description 12 % textOut(strMsg)will write to screen (command window) AND logfile, if global logging is12 % |textOut(strMsg)| will write to screen (command window) AND logfile, if global logging is 13 13 % enabled. 14 14 % 15 % textOut(strMsg, 'screenonly')writes to screen (command window) only.15 % |textOut(strMsg, 'screenonly')| writes to screen (command window) only. 16 16 % 17 % textOut(strMsg, 'logonly')writes to logfile only (global logging must be enabled). If logging17 % |textOut(strMsg, 'logonly')| writes to logfile only (global logging must be enabled). If logging 18 18 % is disabled or somehow failes, the message will not be logged or displayed at all... 19 19 % 20 20 % Note: 21 % To enable logging (to file), set the global var EnableLogging to trueand22 % set Logfilenameto a valid filename. This function distinguishes between21 % To enable logging (to file), set the global var |EnableLogging| to |true| and 22 % set |Logfilename| to a valid filename. This function distinguishes between 23 23 % Windows and Linux systems to use proper linebreaks. 24 % The global variable DisableScreenOutis an on/off switch for the24 % The global variable |DisableScreenOut| is an on/off switch for the 25 25 % complete textOut()-messages that would appear on the command window. 26 % Default setting is false, i.e. there will be no output.26 % Default setting is |false|, i.e. there will be no output. 27 27 % 28 28 % Recommended usage is together with sprintf(), in order to add … … 30 30 % 31 31 % Examples 32 % textOut('This is a message\n');32 %+ textOut('This is a message\n'); 33 33 % 34 % x = 'world';35 % y = 2007;36 % textOut(sprintf('Hello %s, it is the year %d!\n', x, y));37 % %Results in: >> Hello world, it is the year 2007!34 %+ x = 'world'; 35 %+ y = 2007; 36 %+ textOut(sprintf('Hello %s, it is the year %d!\n', x, y)); 37 %+ %Results in: >> Hello world, it is the year 2007! 38 38 % 39 % global EnableLogging40 % global Logfilename41 % EnableLogging = true;42 % Logfilename = 'logfile.txt';43 % textOut(sprintf('Whatever I say here will be logged to the file as well.\n'));39 %+ global EnableLogging 40 %+ global Logfilename 41 %+ EnableLogging = true; 42 %+ Logfilename = 'logfile.txt'; 43 %+ textOut(sprintf('Whatever I say here will be logged to the file as well.\n')); 44 44 % 45 % textOut(sprintf('Only appears in the command window\n'), 'screenonly');45 %+ textOut(sprintf('Only appears in the command window\n'), 'screenonly'); 46 46 % 47 % textOut(sprintf('Only appears in the logfile, if logging enabled\n'), 'logonly');47 %+ textOut(sprintf('Only appears in the logfile, if logging enabled\n'), 'logonly'); 48 48 % 49 % global DisableScreenOut50 % DisableScreenOut = true;51 % textOut(sprintf(['If logging is enabled, this goes to the logfile, ', ...52 % 'if not, this goes nowhere\n']));49 %+ global DisableScreenOut 50 %+ DisableScreenOut = true; 51 %+ textOut(sprintf(['If logging is enabled, this goes to the logfile, ', ... 52 %+ 'if not, this goes nowhere\n'])); 53 53 % 54 54 % … … 58 58 % Copyright: 2007-2008, RWTH Aachen University 59 59 % 60 ; 60 61 % 61 62 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/tictic.m
r201 r282 3 3 % 4 4 % Syntax 5 % tictic(id)5 % |tictic(id)| 6 6 % 7 7 % Description 8 % tictic(id) will start tic command determined by a specific id. E.g.8 % |tictic(id)| will start tic command determined by a specific |id|. E.g. 9 9 % tictic(3) will not influence measurements of tictic(2). 10 10 % 11 11 % Note: 12 % Do not use too large values for id, as they will take up memory. Also12 % Do not use too large values for |id|, as they will take up memory. Also 13 13 % make sure that you do not mix up those tictic ids. 14 14 % Note that toctoc() does not generate a screen output like toc() does. 15 15 % 16 16 % Example 17 % id = 7;18 % tictic(id);19 % % do something...20 % timeTaken = toctoc(id);17 %+ id = 7; 18 %+ tictic(id); 19 %+ % do something... 20 %+ timeTaken = toctoc(id); 21 21 % 22 22 % See also: toctoc … … 27 27 % Copyright: 2007-2008, RWTH Aachen University 28 28 % 29 ; 29 30 % 30 31 % *********************************************************************************************** -
branches/telle/RWTHMindstormsNXT-Lejos/toctoc.m
r201 r282 3 3 % 4 4 % Syntax 5 % seconds = toctoc(id)5 % |seconds = toctoc(id)| 6 6 % 7 7 % Description 8 % toctoc(id)returns the time taken (in seconds) since the call to9 % tictic(id) with the same id. Each idgenerates independent results,8 % |toctoc(id)| returns the time taken (in seconds) since the call to 9 % |tictic(id)| with the same |id|. Each |id| generates independent results, 10 10 % e.g. toctoc(3) will not be influenced by the start of tictic(2). 11 11 % 12 12 % Note: 13 % Do not use too large values for id, as they will take up memory. Also13 % Do not use too large values for |id|, as they will take up memory. Also 14 14 % make sure that you do not mix up those tictic ids. 15 15 % Note that toctoc() does not generate a screen output like toc() does. 16 16 % 17 17 % Example 18 % id = 7;19 % tictic(id);20 % % do something...21 % timeTaken = toctoc(id);18 %+ id = 7; 19 %+ tictic(id); 20 %+ % do something... 21 %+ timeTaken = toctoc(id); 22 22 % 23 23 % See also: tictic … … 28 28 % Copyright: 2007-2008, RWTH Aachen University 29 29 % 30 ; 30 31 % 31 32 % ***********************************************************************************************
