| [823] | 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 4 | <html><head> |
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 6 | <!-- |
|---|
| 7 | This HTML is auto-generated from an M-file. |
|---|
| 8 | To make changes, update the M-file and republish this document. |
|---|
| 9 | --><title>GetSwitch</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2009-10-07"><meta name="m-file" content="script_GetSwitch"> |
|---|
| 10 | <link type="text/css" rel="stylesheet" href="../../style.css"> |
|---|
| 11 | </head><body><div class="content"><h1>GetSwitch</h1><!--introduction--><p>Reads the current value of the NXT switch / touch sensor</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#5">Description</a></li><li><a href="#10">Example</a></li><li><a href="#12">See also</a></li><li><a href="#14">Signature</a></li></ul></div><h2>Syntax<a name="2"></a></h2><p><tt>switch = GetSwitch(port)</tt></p><p><tt>switch = GetSwitch(port, handle)</tt></p><h2>Description<a name="5"></a></h2><p><tt>switch = GetSwitch(port)</tt> returns the current switch value <tt>switch</tt> of the NXT switch / touch sensor. The measurement value <tt>switch</tt> represents the pressing mode of the switch / touch sensor. <tt>true</tt> is returned if the switch / touch sensor is being pressed and <tt>false</tt> if it is being released. The given <tt>port</tt> number specifies the connection port. 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.</p><p>The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call <tt>COM_SetDefaultNXT</tt> to set one).</p><p>For more complex settings the function <tt>NXT_GetInputValues</tt> can be used.</p><h2>Example<a name="10"></a></h2><pre class="codeinput"> OpenSwitch(SENSOR_4); |
|---|
| 12 | switchState = GetSwitch(SENSOR_4); |
|---|
| 13 | CloseSensor(SENSOR_4); |
|---|
| 14 | </pre><h2>See also<a name="12"></a></h2><p>NXT_GetInputValues, OpenSwitch, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4</p><h2>Signature<a name="14"></a></h2><div><ul><li><b>Author:</b> Linus Atorf, Alexander Behrens (see AUTHORS)</li><li><b>Date:</b> 2008/12/05</li><li><b>Copyright:</b> 2007-2009, RWTH Aachen University</li></ul></div><p class="footer"><br> |
|---|
| 15 | </p></div><!-- |
|---|
| 16 | ##### SOURCE BEGIN ##### |
|---|
| 17 | %% GetSwitch |
|---|
| 18 | % Reads the current value of the NXT switch / touch sensor |
|---|
| 19 | %% |
|---|
| 20 | %% Syntax |
|---|
| 21 | % |switch = GetSwitch(port)| |
|---|
| 22 | %% |
|---|
| 23 | % |switch = GetSwitch(port, handle)| |
|---|
| 24 | %% |
|---|
| 25 | %% Description |
|---|
| 26 | % |switch = GetSwitch(port)| returns the current switch value |switch| of the NXT switch / touch |
|---|
| 27 | % sensor. The measurement value |switch| represents the pressing mode of the switch / touch |
|---|
| 28 | % sensor. |true| is returned if the switch / touch sensor is being pressed and |false| if it is |
|---|
| 29 | % being released. The given |port| number specifies the connection port. The value |port| can be |
|---|
| 30 | % addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to |
|---|
| 31 | % the labeling on the NXT Brick. |
|---|
| 32 | %% |
|---|
| 33 | % The last optional argument can be a valid NXT handle. If none is |
|---|
| 34 | % specified, the default handle will be used (call |COM_SetDefaultNXT| to |
|---|
| 35 | % set one). |
|---|
| 36 | %% |
|---|
| 37 | % For more complex settings the function |NXT_GetInputValues| can be used. |
|---|
| 38 | %% |
|---|
| 39 | %% |
|---|
| 40 | %% Example |
|---|
| 41 | OpenSwitch(SENSOR_4); |
|---|
| 42 | switchState = GetSwitch(SENSOR_4); |
|---|
| 43 | CloseSensor(SENSOR_4); |
|---|
| 44 | %% |
|---|
| 45 | %% See also |
|---|
| 46 | % NXT_GetInputValues, OpenSwitch, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 |
|---|
| 47 | %% |
|---|
| 48 | %% Signature |
|---|
| 49 | %% |
|---|
| 50 | % * *Author:* Linus Atorf, Alexander Behrens (see AUTHORS) |
|---|
| 51 | % * *Date:* 2008/12/05 |
|---|
| 52 | % * *Copyright:* 2007-2009, RWTH Aachen University |
|---|
| 53 | % |
|---|
| 54 | |
|---|
| 55 | ##### SOURCE END ##### |
|---|
| 56 | --></body></html> |
|---|