NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
DISTNx.h
1 
2 // DISTNx.h
3 //
4 // This is a class for reading from DIST-Nx, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=73
6 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=72
7 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=69
8 
9 // Initial version: 2010-06-10 by Andrew Sylvester
10 // Large parts of the code is ported from the NXC library for the device,
11 // written by Deepak Patil.
12 
13 /*
14  This library is free software; you can redistribute it and/or
15  modify it under the terms of the GNU Lesser General Public
16  License as published by the Free Software Foundation; either
17  version 2.1 of the License, or (at your option) any later version.
18 
19  This library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  Lesser General Public License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public
25  License along with this library; if not, write to the Free Software
26  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28 
29 
30 #ifndef DISTNx_H
31 #define DISTNx_H
32 
33 #define DISTNx_Command 0x41
34 #define DISTNx_Distance 0x42
35 #define DISTNx_Voltage 0x44
36 #define DISTNx_SensorType 0x50
37 
38 #include "NXShieldI2C.h"
39 
43 class DISTNx : public NXShieldI2C
44 {
45 public:
47  DISTNx(uint8_t i2c_address = 0x02);
48 
50  uint8_t issueCommand(char command);
51 
53  bool energize();
54 
56  bool deEnergize();
57 
59  int getDist();
60 
62  int getVolt();
63 
65  short getType();
66 
67 };
68 
69 #endif
This class implements I2C interfaces used by NXShield.
Definition: NXShieldI2C.h:32
int getVolt()
Definition: DISTNx.cpp:57
DISTNx(uint8_t i2c_address=0x02)
Definition: DISTNx.cpp:33
bool energize()
Definition: DISTNx.cpp:42
short getType()
Definition: DISTNx.cpp:62
bool deEnergize()
Definition: DISTNx.cpp:47
int getDist()
Definition: DISTNx.cpp:52
uint8_t issueCommand(char command)
Definition: DISTNx.cpp:37
This class interfaces with DIST-Nx attached to NXShield.
Definition: DISTNx.h:43