| 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>OpenColor</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.8"> |
|---|
| 14 | <meta name="date" content="2009-07-17"> |
|---|
| 15 | <meta name="m-file" content="script_OpenColor"> |
|---|
| 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>OpenColor</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>Initializes and sets the mode of the HiTechnic color 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="#11">Examples</a></li> |
|---|
| 31 | <li><a href="#13">See also</a></li> |
|---|
| 32 | <li><a href="#15">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="2"></a></h2> |
|---|
| 36 | <p><tt>OpenColor(port)</tt></p> |
|---|
| 37 | <p><tt>OpenColor(port, handle)</tt></p> |
|---|
| 38 | <h2>Description<a name="5"></a></h2> |
|---|
| 39 | <p><tt>OpenColor(port)</tt> initializes the input mode of HiTechnic Color sensor specified by the sensor 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. |
|---|
| 40 | </p> |
|---|
| 41 | <p>With <tt>GetColor(port)</tt> you can receive color values as RGB or Index. |
|---|
| 42 | </p> |
|---|
| 43 | <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). |
|---|
| 44 | </p> |
|---|
| 45 | <p>Since the Color sensor is a digital sensor (that uses the I²C protocol), the function <tt>NXT_SetInputMode</tt> cannot be used as for analog sensors. |
|---|
| 46 | </p> |
|---|
| 47 | <h2>Examples<a name="11"></a></h2><pre class="codeinput"> OpenColor(SENSOR_2); |
|---|
| 48 | [index r g b] = GetColor(SENSOR_2, 0); |
|---|
| 49 | CloseSensor(SENSOR_2); |
|---|
| 50 | </pre><h2>See also<a name="13"></a></h2> |
|---|
| 51 | <p><a href="GetColor.html">GetColor</a>, <a href="CloseSensor.html">CloseSensor</a>, <a href="COM_ReadI2C.html">COM_ReadI2C</a>, <a href="NXT_LSGetStatus.html">NXT_LSGetStatus</a>, <a href="NXT_LSRead.html">NXT_LSRead</a>, </p> |
|---|
| 52 | <h2>Signature<a name="15"></a></h2> |
|---|
| 53 | <div> |
|---|
| 54 | <ul> |
|---|
| 55 | <li><b>Author:</b> Rainer Schnitzler (see AUTHORS) |
|---|
| 56 | </li> |
|---|
| 57 | <li><b>Date:</b> 2008/10/01 |
|---|
| 58 | </li> |
|---|
| 59 | <li><b>Copyright:</b> 2007-2009, RWTH Aachen University |
|---|
| 60 | </li> |
|---|
| 61 | </ul> |
|---|
| 62 | </div> |
|---|
| 63 | <p class="footer"><br> |
|---|
| 64 | Published with wg_publish; V1.0<br></p> |
|---|
| 65 | </div> |
|---|
| 66 | <!-- |
|---|
| 67 | ##### SOURCE BEGIN ##### |
|---|
| 68 | %% OpenColor |
|---|
| 69 | % Initializes and sets the mode of the HiTechnic color sensor |
|---|
| 70 | %% |
|---|
| 71 | %% Syntax |
|---|
| 72 | % |OpenColor(port)| |
|---|
| 73 | %% |
|---|
| 74 | % |OpenColor(port, handle)| |
|---|
| 75 | %% |
|---|
| 76 | %% Description |
|---|
| 77 | % |OpenColor(port)| initializes the input mode of HiTechnic Color sensor specified by the sensor |
|---|
| 78 | % port. The value |port| can be addressed by the symbolic constants |
|---|
| 79 | % |SENSOR_1| , |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling on the NXT Brick. |
|---|
| 80 | %% |
|---|
| 81 | % With |GetColor(port)| you can receive color values as RGB or Index. |
|---|
| 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 | % Since the Color sensor is a digital sensor (that uses the I²C protocol), |
|---|
| 88 | % the function |NXT_SetInputMode| cannot be used as for analog sensors. |
|---|
| 89 | %% |
|---|
| 90 | %% |
|---|
| 91 | %% Examples |
|---|
| 92 | OpenColor(SENSOR_2); |
|---|
| 93 | [index r g b] = GetColor(SENSOR_2, 0); |
|---|
| 94 | CloseSensor(SENSOR_2); |
|---|
| 95 | %% |
|---|
| 96 | %% See also |
|---|
| 97 | % GetColor, CloseSensor, COM_ReadI2C, NXT_LSGetStatus, NXT_LSRead |
|---|
| 98 | %% |
|---|
| 99 | %% Signature |
|---|
| 100 | %% |
|---|
| 101 | % * *Author:* Rainer Schnitzler (see AUTHORS) |
|---|
| 102 | % * *Date:* 2008/10/01 |
|---|
| 103 | % * *Copyright:* 2007-2009, RWTH Aachen University |
|---|
| 104 | % |
|---|
| 105 | |
|---|
| 106 | ##### SOURCE END ##### |
|---|
| 107 | --> |
|---|
| 108 | </body> |
|---|
| 109 | </html> |
|---|