root/tags/version-4.02/RWTHMindstormsNXT/doc/functions/help/NXT_GetInputValues.html @ 823

Revision 823, 6.0 KB (checked in by atorf, 4 years ago)

/!\ Create tag for version-4.02

Line 
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   <!--
7This HTML is auto-generated from an M-file.
8To make changes, update the M-file and republish this document.
9      --><title>NXT_GetInputValues</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2009-10-07"><meta name="m-file" content="script_NXT_GetInputValues">
10<link type="text/css" rel="stylesheet" href="../../style.css">
11  </head><body><div class="content"><h1>NXT_GetInputValues</h1><!--introduction--><p>Executes a complete sensor reading (requests and retrieves input values)</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#5">Description</a></li><li><a href="#26">Examples</a></li><li><a href="#29">See also</a></li><li><a href="#31">Signature</a></li></ul></div><h2>Syntax<a name="2"></a></h2><p><tt>data = NXT_GetInputValues(port)</tt></p><p><tt>data = NXT_GetInputValues(port, handle)</tt></p><h2>Description<a name="5"></a></h2><p><tt>data = NXT_GetInputValues(port)</tt> processes a complete sensor reading, i.e. requests input values and collects the answer 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>data</tt> is a struct variable. It contains several sensor settings and information.</p><p><tt>data = NXT_GetInputValues(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.</p><p>If no Bluetooth handle is specified the default one (<tt>COM_GetDefaultNXT</tt>) is used.</p><p><b>Output:</b></p><p><tt>data.Port</tt>               % current port number (<tt>0..3</tt>)</p><p><tt>data.Valid</tt>              % validation flag</p><p><tt>data.Calibrated</tt>         % boolean, <tt>true</tt> if calibration file found and used</p><p><tt>data.TypeByte</tt>           % sensor type</p><p><tt>data.TypeName</tt>           % sensor mode</p><p><tt>data.ModeByte</tt>           % mode</p><p><tt>data.ModeName</tt>           % mode name</p><p><tt>data.RawADVal</tt>           % raw A/D value</p><p><tt>data.NormalizedADVal</tt>    % normalized A/D value</p><p><tt>data.ScaledVal</tt>          % scaled value</p><p><tt>data.CalibratedVal</tt>      % calibrated value</p><p><b>Note:</b></p><p>Data are only valid if <tt>.Valid</tt> is ~= 0. This should usually be the case, but a short while after setting a new sensor mode using <tt>NXT_SetInputMode</tt>, you have to carefully check .Valid on your own! Experience shows that only <tt>.ScaledVal</tt> is influenced by this, apparently <tt>.NormalizedADVal</tt> seems valid all the time, but closer examination is needed...</p><p>For more details see the official LEGO Mindstorms communication protocol.</p><h2>Examples<a name="26"></a></h2><pre class="codeinput">   data = NXT_GetInputValues(SENSOR_3);
12</pre><pre class="codeinput">   handle = COM_OpenNXT(<span class="string">'bluetooth.ini'</span>);
13   data = NXT_GetInputValues(SENSOR_1, handle);
14</pre><h2>See also<a name="29"></a></h2><p>NXT_SetInputMode, GetLight, GetSwitch, GetSound, GetUltrasonic, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4</p><h2>Signature<a name="31"></a></h2><div><ul><li><b>Author:</b> Linus Atorf (see AUTHORS)</li><li><b>Date:</b> 2007/10/15</li><li><b>Copyright:</b> 2007-2009, RWTH Aachen University</li></ul></div><p class="footer"><br>
15</p></div><!--
16##### SOURCE BEGIN #####
17%% NXT_GetInputValues
18% Executes a complete sensor reading (requests and retrieves input values)
19%%
20%% Syntax
21% |data = NXT_GetInputValues(port)|
22%%
23% |data = NXT_GetInputValues(port, handle)|
24%%
25%% Description
26% |data = NXT_GetInputValues(port)| processes a complete sensor reading, i.e. requests input
27% values and collects the answer of the given sensor |port|. The value |port| can be addressed by
28% the symbolic constants |SENSOR_1|, |SENSOR_2|, |SENSOR_3| and |SENSOR_4| analog to the labeling
29% on the NXT Brick. The return value |data| is a struct variable. It contains several sensor
30% settings and information.
31%%
32% |data = NXT_GetInputValues(port, handle)| uses the given Bluetooth connection |handle|. This should be a
33% serial handle on a PC system and a file handle on a Linux system.
34%%
35% If no Bluetooth handle is specified the default one (|COM_GetDefaultNXT|) is used.
36%%
37%%
38% *Output:*
39%%
40% |data.Port|               % current port number (|0..3|)
41%%
42% |data.Valid|              % validation flag
43%%
44% |data.Calibrated|         % boolean, |true| if calibration file found and used
45%%
46% |data.TypeByte|           % sensor type
47%%
48% |data.TypeName|           % sensor mode
49%%
50% |data.ModeByte|           % mode
51%%
52% |data.ModeName|           % mode name
53%%
54% |data.RawADVal|           % raw A/D value
55%%
56% |data.NormalizedADVal|    % normalized A/D value
57%%
58% |data.ScaledVal|          % scaled value
59%%
60% |data.CalibratedVal|      % calibrated value
61%%
62%%
63% *Note:*
64%%
65% Data are only valid if |.Valid| is ~= 0. This should usually be the
66% case, but a short while after setting a new sensor mode using
67% |NXT_SetInputMode|, you have to carefully check .Valid on your own!
68% Experience shows that only |.ScaledVal| is influenced by this, apparently
69% |.NormalizedADVal| seems valid all the time, but closer examination is
70% needed...
71%%
72% For more details see the official LEGO Mindstorms communication protocol.
73%%
74%% Examples
75   data = NXT_GetInputValues(SENSOR_3);
76%%
77   handle = COM_OpenNXT('bluetooth.ini');
78   data = NXT_GetInputValues(SENSOR_1, handle);
79%%
80%% See also
81% NXT_SetInputMode, GetLight, GetSwitch, GetSound, GetUltrasonic, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4
82%%
83%% Signature
84%%
85% * *Author:* Linus Atorf (see AUTHORS)
86% * *Date:* 2007/10/15
87% * *Copyright:* 2007-2009, RWTH Aachen University
88%
89
90##### SOURCE END #####
91--></body></html>
Note: See TracBrowser for help on using the browser.