| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> |
|---|
| 4 | <html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"> |
|---|
| 5 | <head> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | This HTML is auto-generated from an M-file. |
|---|
| 10 | To make changes, update the M-file and republish this document. |
|---|
| 11 | --> |
|---|
| 12 | <title>NXT_LSGetStatus</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.5"> |
|---|
| 14 | <meta name="date" content="2008-01-28"> |
|---|
| 15 | <meta name="m-file" content="script_NXT_LSGetStatus"> |
|---|
| 16 | <link type="text/css" rel="stylesheet" href="../../style.css"> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | <p class="header">RWTH - Mindstorms NXT Toolbox</p> |
|---|
| 20 | <div class="content"> |
|---|
| 21 | <h1>NXT_LSGetStatus</h1> |
|---|
| 22 | <introduction> |
|---|
| 23 | <p>Gets the number of available bytes from low speed (digital) sensor (e.g. ultrasonic)</p> |
|---|
| 24 | </introduction> |
|---|
| 25 | <h2>Contents</h2> |
|---|
| 26 | <div> |
|---|
| 27 | <ul> |
|---|
| 28 | <li><a href="#1">Syntax</a></li> |
|---|
| 29 | <li><a href="#3">Description</a></li> |
|---|
| 30 | <li><a href="#10">Examples</a></li> |
|---|
| 31 | <li><a href="#12">See also</a></li> |
|---|
| 32 | <li><a href="#13">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="1"></a></h2> |
|---|
| 36 | <p><tt>[BytesReady status] = NXT_LSGetStatus(port)</tt></p> |
|---|
| 37 | <p><tt>[BytesReady status] = NXT_LSGetStatus(port, handle)</tt></p> |
|---|
| 38 | <h2>Description<a name="3"></a></h2> |
|---|
| 39 | <p><tt>[BytesReady status] = NXT_LSGetStatus(port)</tt> gets the number of available bytes from the low speed (digital) sensor reading of the given sensor <tt>port</tt>. The value <tt>port</tt> can be addressed by the symbolic constants <tt>SENSOR_1</tt>, <tt>SENSOR_2</tt>, <tt>SENSOR_3</tt> and <tt>SENSOR_4</tt> analog to the labeling on the NXT Brick. The return value <tt>BytesReady</tt> contains the number of bytes available to read. <tt>status</tt> indicates if an error occures by the packet transmission. Function <tt>checkStatusBytes</tt> is interpreting this information per default. |
|---|
| 40 | </p> |
|---|
| 41 | <p><tt>[BytesReady status] = NXT_LSGetStatus(port, handle)</tt> uses the given Bluetooth connection <tt>handle</tt>. This should be a serial handle on a PC system and a file handle on a Linux system. |
|---|
| 42 | </p> |
|---|
| 43 | <p>If no Bluetooth handle is specified the default one (<tt>BT_GetDefaultHandle</tt>) is used. |
|---|
| 44 | </p> |
|---|
| 45 | <p>For more details see the official LEGO Mindstorms communication protocol.</p> |
|---|
| 46 | <p><b>Note:</b></p> |
|---|
| 47 | <p>This function's status byte sometimes contains an error message: "Pending communication transaction in progress". This is |
|---|
| 48 | by design (see documentation of NXTCommLSCheckStatus on page 70 of the "LEGO Mindstorms NXT Executable File Specification" |
|---|
| 49 | document). |
|---|
| 50 | </p> |
|---|
| 51 | <p>Before using LS commands, the sensor mode has to be set to <tt>LOWSPEED_9V</tt> using the NXT_SetInputMode command. |
|---|
| 52 | </p> |
|---|
| 53 | <h2>Examples<a name="10"></a></h2><pre class="codeinput"> [BytesReady status] = NXT_LSGetStatus(SENSOR_3); |
|---|
| 54 | </pre><pre class="codeinput"> bt_handle = BT_OpenHandle(<span class="string">'bluetooth.ini'</span>,<span class="string">'check'</span>); |
|---|
| 55 | NXT_SetInputMode(SENSOR_1, <span class="string">'LOWSPEED_9V'</span>, <span class="string">'RAWMODE'</span>, <span class="string">'dontreply'</span>); |
|---|
| 56 | <span class="comment">% note that status can contain errorsmessages, use checkStatusByte</span> |
|---|
| 57 | [BytesReady status] = NXT_LSGetStatus(SENSOR_1, bt_handle); |
|---|
| 58 | </pre><h2>See also<a name="12"></a></h2> |
|---|
| 59 | <p><a href="NXT_SetInputMode.html">NXT_SetInputMode</a>, <a href="checkStatusByte.html">checkStatusByte</a>, <a href="NXT_LSWrite.html">NXT_LSWrite</a>, <a href="NXT_LSRead.html">NXT_LSRead</a></p> |
|---|
| 60 | <h2>Signature<a name="13"></a></h2> |
|---|
| 61 | <div> |
|---|
| 62 | <ul> |
|---|
| 63 | <li><b>Author:</b> Linus Atorf (see AUTHORS) |
|---|
| 64 | </li> |
|---|
| 65 | <li><b>Date:</b> 2007/10/15 |
|---|
| 66 | </li> |
|---|
| 67 | <li><b>Copyright:</b> 2007, RWTH Aachen University |
|---|
| 68 | </li> |
|---|
| 69 | </ul> |
|---|
| 70 | </div> |
|---|
| 71 | <p class="footer"><br> |
|---|
| 72 | Published with wg_publish; V1.0<br></p> |
|---|
| 73 | </div> |
|---|
| 74 | <!-- |
|---|
| 75 | ##### SOURCE BEGIN ##### |
|---|
| 76 | %% NXT_LSGetStatus |
|---|
| 77 | % Gets the number of available bytes from low speed (digital) sensor (e.g. ultrasonic) |
|---|
| 78 | %% |
|---|
| 79 | %% Syntax |
|---|
| 80 | % |[BytesReady status] = NXT_LSGetStatus(port)| |
|---|
| 81 | %% |
|---|
| 82 | % |[BytesReady status] = NXT_LSGetStatus(port, handle)| |
|---|
| 83 | %% |
|---|
| 84 | %% Description |
|---|
| 85 | % |[BytesReady status] = NXT_LSGetStatus(port)| gets the number of available bytes from the low speed (digital) |
|---|
| 86 | % sensor reading of the given sensor |port|. The value |port| can be addressed by |
|---|
| 87 | % the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling |
|---|
| 88 | % on the NXT Brick. The return value |BytesReady| contains the number of bytes available to read. |
|---|
| 89 | % |status| indicates if an error occures by the packet transmission. Function |checkStatusBytes| |
|---|
| 90 | % is interpreting this information per default. |
|---|
| 91 | %% |
|---|
| 92 | % |[BytesReady status] = NXT_LSGetStatus(port, handle)| uses the given Bluetooth connection |handle|. This should be a |
|---|
| 93 | % serial handle on a PC system and a file handle on a Linux system. |
|---|
| 94 | %% |
|---|
| 95 | % If no Bluetooth handle is specified the default one (|BT_GetDefaultHandle|) is used. |
|---|
| 96 | %% |
|---|
| 97 | % For more details see the official LEGO Mindstorms communication protocol. |
|---|
| 98 | %% |
|---|
| 99 | %% |
|---|
| 100 | % *Note:* |
|---|
| 101 | %% |
|---|
| 102 | % This function's status byte sometimes contains an error message: "Pending communication |
|---|
| 103 | % transaction in progress". This is by design (see documentation of NXTCommLSCheckStatus |
|---|
| 104 | % on page 70 of the "LEGO Mindstorms NXT Executable File Specification" document). |
|---|
| 105 | %% |
|---|
| 106 | % Before using LS commands, the sensor mode has to be set to |
|---|
| 107 | % |LOWSPEED_9V| using the NXT_SetInputMode command. |
|---|
| 108 | %% |
|---|
| 109 | %% |
|---|
| 110 | %% Examples |
|---|
| 111 | [BytesReady status] = NXT_LSGetStatus(SENSOR_3); |
|---|
| 112 | %% |
|---|
| 113 | bt_handle = BT_OpenHandle('bluetooth.ini','check'); |
|---|
| 114 | NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); |
|---|
| 115 | % note that status can contain errorsmessages, use checkStatusByte |
|---|
| 116 | [BytesReady status] = NXT_LSGetStatus(SENSOR_1, bt_handle); |
|---|
| 117 | %% |
|---|
| 118 | %% See also |
|---|
| 119 | % NXT_SetInputMode, checkStatusByte, NXT_LSWrite, NXT_LSRead |
|---|
| 120 | %% |
|---|
| 121 | %% |
|---|
| 122 | %% Signature |
|---|
| 123 | %% |
|---|
| 124 | % * *Author:* Linus Atorf (see AUTHORS) |
|---|
| 125 | % * *Date:* 2007/10/15 |
|---|
| 126 | % * *Copyright:* 2007, RWTH Aachen University |
|---|
| 127 | % |
|---|
| 128 | |
|---|
| 129 | ##### SOURCE END ##### |
|---|
| 130 | --> |
|---|
| 131 | </body> |
|---|
| 132 | </html> |
|---|