EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_DISTNx.h
1 
2 // EVs_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 // Modified for EVShield: 2015-2-16 by Michael Giles
11 // Large parts of the code is ported from the NXC library for the device,
12 // written by Deepak Patil.
13 
14 /*
15  This library is free software; you can redistribute it and/or
16  modify it under the terms of the GNU Lesser General Public
17  License as published by the Free Software Foundation; either
18  version 2.1 of the License, or (at your option) any later version.
19 
20  This library is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  Lesser General Public License for more details.
24 
25  You should have received a copy of the GNU Lesser General Public
26  License along with this library; if not, write to the Free Software
27  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29 
30 
31 #ifndef EVs_DISTNx_H
32 #define EVs_DISTNx_H
33 
34 #define DISTNx_Command 0x41
35 #define DISTNx_Distance 0x42
36 #define DISTNx_Voltage 0x44
37 #define DISTNx_SensorType 0x50
38 
39 #include "EVShieldI2C.h"
40 
44 class EVs_DISTNx : public EVShieldI2C
45 {
46 public:
48  EVs_DISTNx(uint8_t i2c_address = 0x02);
49 
51  uint8_t issueCommand(char command);
52 
54  bool energize();
55 
57  bool deEnergize();
58 
60  int getDist();
61 
63  int getVolt();
64 
66  short getType();
67 
68 };
69 
70 #endif
bool deEnergize()
Definition: EVs_DISTNx.cpp:48
short getType()
Definition: EVs_DISTNx.cpp:63
This class interfaces with DIST-Nx attached to EVShield.
Definition: EVs_DISTNx.h:44
uint8_t issueCommand(char command)
Definition: EVs_DISTNx.cpp:38
EVs_DISTNx(uint8_t i2c_address=0x02)
Definition: EVs_DISTNx.cpp:34
bool energize()
Definition: EVs_DISTNx.cpp:43
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
int getDist()
Definition: EVs_DISTNx.cpp:53
int getVolt()
Definition: EVs_DISTNx.cpp:58