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