colorsensor +a
Fork of ColorSensor by
ColorSensor.h@1:51fc088353e7, 2013-09-19 (annotated)
- Committer:
- ryuna
- Date:
- Thu Sep 19 05:30:08 2013 +0000
- Revision:
- 1:51fc088353e7
- Parent:
- 0:c5bc72734cbf
colorsensor+a
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(); |
ryuna | 1:51fc088353e7 | 23 | void timenow(unsigned short times); |
OGA | 0:c5bc72734cbf | 24 | }; |