| 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>GetSound</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.7"> |
|---|
| 14 | <meta name="date" content="2008-11-04"> |
|---|
| 15 | <meta name="m-file" content="script_GetSound"> |
|---|
| 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>GetSound</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>Reads the current value of the NXT sound sensor</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="#9">Example</a></li> |
|---|
| 31 | <li><a href="#11">See also</a></li> |
|---|
| 32 | <li><a href="#13">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="2"></a></h2> |
|---|
| 36 | <p><tt>sound = GetSound(port)</tt></p> |
|---|
| 37 | <p><tt>sound = GetSound(port, handle)</tt></p> |
|---|
| 38 | <h2>Description<a name="5"></a></h2> |
|---|
| 39 | <p><tt>sound = GetSound(port)</tt> returns the current sound value <tt>sound</tt> of the NXT sound sensor. The measurement value <tt>sound</tt> represents the normalized (default) sound value (0..1023 / 10 Bit). The normalized value mode is set per default by the function |
|---|
| 40 | <tt>OpenSound</tt>. 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. |
|---|
| 41 | </p> |
|---|
| 42 | <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). |
|---|
| 43 | </p> |
|---|
| 44 | <p>For more complex settings the function <tt>NXT_GetInputMode</tt> can be used. |
|---|
| 45 | </p> |
|---|
| 46 | <h2>Example<a name="9"></a></h2><pre class="codeinput"> OpenSound(SENSOR_1, <span class="string">'DB'</span>); |
|---|
| 47 | sound = GetSound(SENSOR_1); |
|---|
| 48 | CloseSensor(SENSOR_1); |
|---|
| 49 | </pre><h2>See also<a name="11"></a></h2> |
|---|
| 50 | <p><a href="NXT_SetInputMode.html">NXT_SetInputMode</a>, <a href="OpenLight.html">OpenLight</a>, <a href="CloseSensor.html">CloseSensor</a>, <a href="SENSOR_1.html">SENSOR_1</a>, <a href="SENSOR_2.html">SENSOR_2</a>, <a href="SENSOR_3.html">SENSOR_3</a>, <a href="SENSOR_4.html">SENSOR_4</a></p> |
|---|
| 51 | <h2>Signature<a name="13"></a></h2> |
|---|
| 52 | <div> |
|---|
| 53 | <ul> |
|---|
| 54 | <li><b>Author:</b> Linus Atorf, Alexander Behrens (see AUTHORS) |
|---|
| 55 | </li> |
|---|
| 56 | <li><b>Date:</b> 2007/10/15 |
|---|
| 57 | </li> |
|---|
| 58 | <li><b>Copyright:</b> 2007-2008, RWTH Aachen University |
|---|
| 59 | </li> |
|---|
| 60 | </ul> |
|---|
| 61 | </div> |
|---|
| 62 | <p class="footer"><br> |
|---|
| 63 | Published with wg_publish; V1.0<br></p> |
|---|
| 64 | </div> |
|---|
| 65 | <!-- |
|---|
| 66 | ##### SOURCE BEGIN ##### |
|---|
| 67 | %% GetSound |
|---|
| 68 | % Reads the current value of the NXT sound sensor |
|---|
| 69 | %% |
|---|
| 70 | %% Syntax |
|---|
| 71 | % |sound = GetSound(port)| |
|---|
| 72 | %% |
|---|
| 73 | % |sound = GetSound(port, handle)| |
|---|
| 74 | %% |
|---|
| 75 | %% Description |
|---|
| 76 | % |sound = GetSound(port)| returns the current sound value |sound| of the NXT sound |
|---|
| 77 | % sensor. The measurement value |sound| represents the normalized (default) sound value (0..1023 / |
|---|
| 78 | % 10 Bit). The normalized value mode is set per default by the function |OpenSound|. |
|---|
| 79 | % The given |port| number specifies the connection port. The value |port| can be |
|---|
| 80 | % addressed by the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to |
|---|
| 81 | % the labeling on the NXT Brick. |
|---|
| 82 | %% |
|---|
| 83 | % The last optional argument can be a valid NXT handle. If none is |
|---|
| 84 | % specified, the default handle will be used (call |COM_SetDefaultNXT| to |
|---|
| 85 | % set one). |
|---|
| 86 | %% |
|---|
| 87 | % For more complex settings the function |NXT_GetInputMode| can be used. |
|---|
| 88 | %% |
|---|
| 89 | %% Example |
|---|
| 90 | OpenSound(SENSOR_1, 'DB'); |
|---|
| 91 | sound = GetSound(SENSOR_1); |
|---|
| 92 | CloseSensor(SENSOR_1); |
|---|
| 93 | %% |
|---|
| 94 | %% See also |
|---|
| 95 | % NXT_SetInputMode, OpenLight, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4 |
|---|
| 96 | %% |
|---|
| 97 | %% Signature |
|---|
| 98 | %% |
|---|
| 99 | % * *Author:* Linus Atorf, Alexander Behrens (see AUTHORS) |
|---|
| 100 | % * *Date:* 2007/10/15 |
|---|
| 101 | % * *Copyright:* 2007-2008, RWTH Aachen University |
|---|
| 102 | % |
|---|
| 103 | |
|---|
| 104 | ##### SOURCE END ##### |
|---|
| 105 | --> |
|---|
| 106 | </body> |
|---|
| 107 | </html> |
|---|