ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
device/SonarSensor.h
00001 //
00002 // SonarSensor.h
00003 //
00004 // Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer
00005 //
00006 
00007 #ifndef SONARSENSOR_H_
00008 #define SONARSENSOR_H_
00009 
00010 #include "I2c.h"
00011 
00012 namespace ecrobot
00013 {
00052 class SonarSensor: public I2c
00053 // Sonar sensor supports various commands to interact with the NXT,
00054 // thus it is derived from I2C to allow user to use send/receive I2c member functions
00055 {
00056 public:
00066         explicit SonarSensor(ePortS port);
00067 
00073         S16 getDistance(void) const;
00074 
00082         inline void get(U8 data[1]) const { receive(0x42, data, 1); }
00083 
00084 };
00085 }
00086 
00087 #endif
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines