pan
ColorSensor.h@0:c5bc72734cbf, 2013-09-12 (annotated)
- Committer:
- OGA
- Date:
- Thu Sep 12 12:06:29 2013 +0000
- Revision:
- 0:c5bc72734cbf
jum
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
OGA | 0:c5bc72734cbf | 1 | #include "mbed.h" |
OGA | 0:c5bc72734cbf | 2 | #define RED 0 |
OGA | 0:c5bc72734cbf | 3 | #define GREEN 1 |
OGA | 0:c5bc72734cbf | 4 | #define BLUE 2 |
OGA | 0:c5bc72734cbf | 5 | #define OTHER 3 |
OGA | 0:c5bc72734cbf | 6 | class ColorSensor |
OGA | 0:c5bc72734cbf | 7 | { |
OGA | 0:c5bc72734cbf | 8 | private: |
OGA | 0:c5bc72734cbf | 9 | DigitalIn *Dout; |
OGA | 0:c5bc72734cbf | 10 | DigitalOut *Range; |
OGA | 0:c5bc72734cbf | 11 | DigitalOut *CK; |
OGA | 0:c5bc72734cbf | 12 | DigitalOut *Gate; |
OGA | 0:c5bc72734cbf | 13 | int time; |
OGA | 0:c5bc72734cbf | 14 | double R, G, B; |
OGA | 0:c5bc72734cbf | 15 | public: |
OGA | 0:c5bc72734cbf | 16 | ColorSensor(PinName Dout, PinName Range, PinName CK, PinName Gate, int time); |
OGA | 0:c5bc72734cbf | 17 | ColorSensor(void); |
OGA | 0:c5bc72734cbf | 18 | void getRGB(unsigned short RGB[]); |
OGA | 0:c5bc72734cbf | 19 | void getRGB(unsigned& R, unsigned& G, unsigned& B); |
OGA | 0:c5bc72734cbf | 20 | unsigned checkRGB(unsigned& R, unsigned& G, unsigned& B); |
OGA | 0:c5bc72734cbf | 21 | int judge(); |
OGA | 0:c5bc72734cbf | 22 | void setWhite(); |
OGA | 0:c5bc72734cbf | 23 | }; |