| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 4 | <html> |
|---|
| 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_GetOutputState</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.7"> |
|---|
| 14 | <meta name="date" content="2008-11-05"> |
|---|
| 15 | <meta name="m-file" content="script_NXT_GetOutputState"> |
|---|
| 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_GetOutputState</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>Requests and retrieves an output motor state reading</p> |
|---|
| 24 | <!--/introduction--> |
|---|
| 25 | <h2>Contents</h2> |
|---|
| 26 | <div> |
|---|
| 27 | <ul> |
|---|
| 28 | <li><a href="#2">Syntax</a></li> |
|---|
| 29 | <li><a href="#5">Description</a></li> |
|---|
| 30 | <li><a href="#27">Examples</a></li> |
|---|
| 31 | <li><a href="#30">See also</a></li> |
|---|
| 32 | <li><a href="#32">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="2"></a></h2> |
|---|
| 36 | <p><tt>data = NXT_GetOutputState(port)</tt></p> |
|---|
| 37 | <p><tt>data = NXT_GetOutputState(port, handle)</tt></p> |
|---|
| 38 | <h2>Description<a name="5"></a></h2> |
|---|
| 39 | <p><tt>data = NXT_GetOutputState(port)</tt> requests and retrieves an output motor state reading of the given motor <tt>port</tt>. The value <tt>port</tt> can be addressed by the symbolic constants <tt>MOTOR_A</tt>, <tt>MOTOR_B</tt> and <tt>MOTOR_C</tt> analog to the labeling on the NXT Brick. The return value <tt>data</tt> is a struct variable. It contains several motor settings and information. |
|---|
| 40 | </p> |
|---|
| 41 | <p><tt>data = NXT_GetOutputState(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>COM_GetDefaultNXT</tt>) is used. |
|---|
| 44 | </p> |
|---|
| 45 | <p><b>Output:</b></p> |
|---|
| 46 | <p><tt>data.Port</tt> % current port number (<tt>0..3</tt>) |
|---|
| 47 | </p> |
|---|
| 48 | <p><tt>data.Power</tt> % current motor power |
|---|
| 49 | </p> |
|---|
| 50 | <p><tt>data.Mode</tt> % motor mode byte |
|---|
| 51 | </p> |
|---|
| 52 | <p><tt>data.ModeIsMOTORON</tt> % flag: "motor is on" |
|---|
| 53 | </p> |
|---|
| 54 | <p><tt>data.ModeIsBRAKE</tt> % flag: "motor uses the advanced brake mode (PVM)" |
|---|
| 55 | </p> |
|---|
| 56 | <p><tt>data.ModeIsREGULATED</tt> % flag: "motor uses a regulation" |
|---|
| 57 | </p> |
|---|
| 58 | <p><tt>data.RegModeByte</tt> % motor regulation byte |
|---|
| 59 | </p> |
|---|
| 60 | <p><tt>data.RegModeName</tt> % name of regulation mode |
|---|
| 61 | </p> |
|---|
| 62 | <p><tt>data.TurnRatio</tt> % turn ratio value |
|---|
| 63 | </p> |
|---|
| 64 | <p><tt>data.RunStateByte</tt> % motor run state byte |
|---|
| 65 | </p> |
|---|
| 66 | <p><tt>data.RegStateName</tt> % name of run state |
|---|
| 67 | </p> |
|---|
| 68 | <p><tt>data.TachoLimit</tt> % tacho / angle limit |
|---|
| 69 | </p> |
|---|
| 70 | <p><tt>data.TachoCount</tt> % current absolute tacho count |
|---|
| 71 | </p> |
|---|
| 72 | <p><tt>data.BlockTachoCount</tt> % current relative tacho count |
|---|
| 73 | </p> |
|---|
| 74 | <p><tt>data.RotationCount</tt> % current second relative tacho count |
|---|
| 75 | </p> |
|---|
| 76 | <p>For more details see the official LEGO Mindstorms communication protocol.</p> |
|---|
| 77 | <h2>Examples<a name="27"></a></h2><pre class="codeinput"> data = NXT_GetOutputState(MOTOR_B); |
|---|
| 78 | </pre><pre class="codeinput"> handle = COM_OpenNXT(<span class="string">'bluetooth.ini'</span>,<span class="string">'check'</span>); |
|---|
| 79 | data = NXT_GetOutputState(MOTOR_A, handle); |
|---|
| 80 | </pre><h2>See also<a name="30"></a></h2> |
|---|
| 81 | <p><a href="GetMotorSettings.html">GetMotorSettings</a>, <a href="SendMotorSettings.html">SendMotorSettings</a>, <a href="NXT_SetOutputState.html">NXT_SetOutputState</a>, <a href="MOTOR_A.html">MOTOR_A</a>, <a href="MOTOR_B.html">MOTOR_B</a>, <a href="MOTOR_C.html">MOTOR_C</a></p> |
|---|
| 82 | <h2>Signature<a name="32"></a></h2> |
|---|
| 83 | <div> |
|---|
| 84 | <ul> |
|---|
| 85 | <li><b>Author:</b> Linus Atorf (see AUTHORS) |
|---|
| 86 | </li> |
|---|
| 87 | <li><b>Date:</b> 2007/10/15 |
|---|
| 88 | </li> |
|---|
| 89 | <li><b>Copyright:</b> 2007-2008, RWTH Aachen University |
|---|
| 90 | </li> |
|---|
| 91 | </ul> |
|---|
| 92 | </div> |
|---|
| 93 | <p class="footer"><br> |
|---|
| 94 | Published with wg_publish; V1.0<br></p> |
|---|
| 95 | </div> |
|---|
| 96 | <!-- |
|---|
| 97 | ##### SOURCE BEGIN ##### |
|---|
| 98 | %% NXT_GetOutputState |
|---|
| 99 | % Requests and retrieves an output motor state reading |
|---|
| 100 | %% |
|---|
| 101 | %% Syntax |
|---|
| 102 | % |data = NXT_GetOutputState(port)| |
|---|
| 103 | %% |
|---|
| 104 | % |data = NXT_GetOutputState(port, handle)| |
|---|
| 105 | %% |
|---|
| 106 | %% Description |
|---|
| 107 | % |data = NXT_GetOutputState(port)| requests and retrieves an output motor state reading of the |
|---|
| 108 | % given motor |port|. The value |port| can be addressed by the symbolic constants |MOTOR_A|, |
|---|
| 109 | % |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT Brick. The return value |data| is a |
|---|
| 110 | % struct variable. It contains several motor settings and information. |
|---|
| 111 | %% |
|---|
| 112 | % |data = NXT_GetOutputState(port, handle)| uses the given Bluetooth connection |handle|. This should be a |
|---|
| 113 | % serial handle on a PC system and a file handle on a Linux system. |
|---|
| 114 | %% |
|---|
| 115 | % If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used. |
|---|
| 116 | %% |
|---|
| 117 | %% |
|---|
| 118 | % *Output:* |
|---|
| 119 | %% |
|---|
| 120 | % |data.Port| % current port number (|0..3|) |
|---|
| 121 | %% |
|---|
| 122 | % |data.Power| % current motor power |
|---|
| 123 | %% |
|---|
| 124 | % |data.Mode| % motor mode byte |
|---|
| 125 | %% |
|---|
| 126 | % |data.ModeIsMOTORON| % flag: "motor is on" |
|---|
| 127 | %% |
|---|
| 128 | % |data.ModeIsBRAKE| % flag: "motor uses the advanced brake mode (PVM)" |
|---|
| 129 | %% |
|---|
| 130 | % |data.ModeIsREGULATED| % flag: "motor uses a regulation" |
|---|
| 131 | %% |
|---|
| 132 | % |data.RegModeByte| % motor regulation byte |
|---|
| 133 | %% |
|---|
| 134 | % |data.RegModeName| % name of regulation mode |
|---|
| 135 | %% |
|---|
| 136 | % |data.TurnRatio| % turn ratio value |
|---|
| 137 | %% |
|---|
| 138 | % |data.RunStateByte| % motor run state byte |
|---|
| 139 | %% |
|---|
| 140 | % |data.RegStateName| % name of run state |
|---|
| 141 | %% |
|---|
| 142 | % |data.TachoLimit| % tacho / angle limit |
|---|
| 143 | %% |
|---|
| 144 | % |data.TachoCount| % current absolute tacho count |
|---|
| 145 | %% |
|---|
| 146 | % |data.BlockTachoCount| % current relative tacho count |
|---|
| 147 | %% |
|---|
| 148 | % |data.RotationCount| % current second relative tacho count |
|---|
| 149 | %% |
|---|
| 150 | % For more details see the official LEGO Mindstorms communication protocol. |
|---|
| 151 | %% |
|---|
| 152 | %% Examples |
|---|
| 153 | data = NXT_GetOutputState(MOTOR_B); |
|---|
| 154 | %% |
|---|
| 155 | handle = COM_OpenNXT('bluetooth.ini','check'); |
|---|
| 156 | data = NXT_GetOutputState(MOTOR_A, handle); |
|---|
| 157 | %% |
|---|
| 158 | %% See also |
|---|
| 159 | % GetMotorSettings, SendMotorSettings, NXT_SetOutputState, MOTOR_A, MOTOR_B, MOTOR_C |
|---|
| 160 | %% |
|---|
| 161 | %% Signature |
|---|
| 162 | %% |
|---|
| 163 | % * *Author:* Linus Atorf (see AUTHORS) |
|---|
| 164 | % * *Date:* 2007/10/15 |
|---|
| 165 | % * *Copyright:* 2007-2008, RWTH Aachen University |
|---|
| 166 | % |
|---|
| 167 | |
|---|
| 168 | ##### SOURCE END ##### |
|---|
| 169 | --> |
|---|
| 170 | </body> |
|---|
| 171 | </html> |
|---|