ECRobot C++ API for LEGO MINDSTORMS NXT
1.0.10
|
00001 // 00002 // ColorSensor.h 00003 // 00004 // Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer 00005 // 00006 00007 #ifndef COLORSENSOR_H_ 00008 #define COLORSENSOR_H_ 00009 00010 #include "I2c.h" 00011 00012 namespace ecrobot 00013 { 00052 class ColorSensor 00053 { 00054 public: 00064 explicit ColorSensor(ePortS port); 00065 00071 U8 getColorNumber(void) const; 00072 00080 void getRawColor(S16 rgb[3]) const; 00081 00102 inline void get(U8 data[14]) const { mI2c.receive(0x42, data, 14); } 00103 00104 00105 private: 00106 I2c mI2c; // composite 00107 }; 00108 } 00109 00110 #endif