Dependents: nhk2018_throwing02 nhk_2018_undercarry_test08 nhk_2018_undercarry_test09 nhk_2018_undercarry_test10 ... more
Fork of TCS3200 by
TCS3200.h
- Committer:
- kenken0721
- Date:
- 2018-03-26
- Revision:
- 2:78984c66a877
- Parent:
- 1:40b638b93be8
- Child:
- 3:62492ac23077
File content as of revision 2:78984c66a877:
#ifndef TCS3200_H #define TCS3200_H #include "mbed.h" #define RED 0 #define GREEN 1 #define BLUE 2 #define CLEAR 3 class TCS3200 { public: /** Create a TCS3200 object connected to the specified pins. * @param S0 Frequency scaling output pin S0 * @param S1 Frequency scaling output pin S1 * @param S2 Photo diode selection output pin S2 * @param S3 Photo diode selection output pin S3 * @param OUT Frequency input pin */ TCS3200(PinName S2, PinName S3, PinName OUT); /** Reads the output signal's HIGH pulse for RED. * @param * None * @return * Duration as nanoseconds (ns). */ long ReadRed(); /** Reads the output signal's HIGH pulse for GREEN. * @param * None * @return * Duration as nanoseconds (ns). */ long ReadGreen(); /** Reads the output signal's HIGH pulse for BLUE. * @param * None * @return * Duration as nanoseconds (ns). */ long ReadBlue(); /** Reads the output signal's HIGH pulse for CLEAR. * @param * None * @return * Duration as nanoseconds (ns). */ long ReadClear(); /** Sets the mode of operation. * @param * mode POWERDOWN, SCALE_2 (2% scaling), SCALE_20 (20% scaling), SCALE_100 (100% scaling). * @return * None */ private: DigitalOut mS2; DigitalOut mS3; InterruptIn signal; Timer timer; Ticker ticker; int coler; long pulsewidth; long red_pulsewidth; long green_pulsewidth; long blue_pulsewidth; long clear_pulsewidth; void HighTrigger(); void LowTrigger(); void fliper(); }; #endif