Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: scolor_TCS3200.h
- Revision:
- 0:fa6bdbdd4239
diff -r 000000000000 -r fa6bdbdd4239 scolor_TCS3200.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scolor_TCS3200.h Thu Feb 28 22:05:21 2019 +0000
@@ -0,0 +1,63 @@
+#ifndef SCOLOR_TCS3200_H
+#define SCOLOR_TCS3200_H
+#include "mbed.h"
+ /* **************************************************************************
+
+@fabeltranm 2019
+fbeltranm@ecci.edu.co
+
+
+ datasheet https://www.mouser.com/catalog/specsheets/TCS3200-E11.pdf
+
+
+ S0 Frequency scaling
+ S1 Frequency scaling
+ S2 Photo diode selection
+ S3 Photo diode selection
+ OutFreq Frequency
+
+ -----------------------------------
+ | ____________ ____________ |
+----> | | | | | | ___ ___
+Light | | Photodiode | | Current |--|---OUTPUT_FREQ | |___| |___
+----> | | Array |---| to | |
+ | | | | Frequency | |
+ | |____________| |____________| |
+ | ^ ^ ^ ^ |
+ -------|--|-------------|--|-------
+ | | | |
+ S2 S3 S0 S1
+
+SO | S1 | OUTPUT FREQUENCY SCALING | | S2 | S3 | PHOTODIODE TYPE |
+ 0 | 0 | power down | | 0 | 0 | Red |
+ 0 | 1 | 2% | | 0 | 1 | Blue |
+ 1 | 0 | 20% | | 1 | 0 | Clear (no filter) |
+ 1 | 1 | 100% | | 1 | 1 | Green |
+
+******************************************************************************/
+
+
+#define SCALE_100 1
+#define SCALE_20 2
+#define SCALE_2 3
+#define POWER_DOWN 4
+
+class scolor_TCS3200 {
+ public:
+ scolor_TCS3200(PinName s0, PinName s1, PinName s2, PinName s3, PinName s_in);
+ long ReadRed(); // retorno el tiempo en alto de OutFreq para Rojo en ns
+ long ReadGreen(); // retorno el tiempo en alto de OutFreq para verde en ns
+ long ReadBlue(); // retorno el tiempo en alto de OutFreq color azul en ns
+ long ReadClear(); // retorno el tiempo en alto de OutFreq sin filtro en ns
+ void SetMode(uint8_t mode);
+ private:
+ DigitalOut _s0;
+ DigitalOut _s1;
+ DigitalOut _s2;
+ DigitalOut _s3;
+ DigitalIn _s_in;
+ Timer timer;
+ long pulsewidth();
+
+};
+#endif
\ No newline at end of file