NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
EV3Sonar.h
1 //EV3SensorAdapter.h
2 //
3 /*
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 /*
19  * History
20  * ------------------------------------------------
21  * Author Date Comments
22  * Deepak 11/21/13 Initial Authoring.
23  * M. Giles 01/28/14 Added I2C address, detect, and fully tested
24  */
25 
26 
27 #ifndef EV3_SONAR_H
28 #define EV3_SONAR_H
29 
30 #define ESA_Command 0x41
31 
32 #include "NXShieldI2C.h"
33 #include "EV3SensorAdapter.h"
34 
38 typedef enum {
39  MODE_Sonar_CM = 0x00,
40  MODE_Sonar_Inches = 0x01,
41  MODE_Sonar_Presence = 0x02,
42 } MODE_Sonar;
46 class EV3Sonar : public EV3SensorAdapter
47 {
48 public:
49  EV3Sonar(uint8_t i2c_address = 0x32);
51  uint8_t setMode(MODE_Sonar);
53  uint8_t detect();
57 };
58 
59 #endif
This class implements EV3 Ultrasonic Sensor using EV3SensorAdapter. Note that the distances returned ...
Definition: EV3Sonar.h:46
uint8_t detect()
Definition: EV3Sonar.cpp:43
This class interfaces with sensor attached to NXShield.
Definition: EV3SensorAdapter.h:34
uint8_t setMode(MODE_Sonar)
Definition: EV3Sonar.cpp:34