TCS3200 Light Sensor

TCS3200 is simple programmable IC which can detect color.

Datasheet

I used YL-64 module which contains TCS3200 IC.

You can wire this up as follows:

Device Pin Espruino
1 (VCC) 5
2 (GND) GND
3 (S0) A0
4 (S1) A1
5 (S2) A2
6 (S3) A3
7 (E0) GND
8 (OUT) A4

How to use the module:

var sensor = require("TCS3200").connect(A0, A1, A2, A3, A4);
setInterval(function(){
  var c = sensor.getColor();
  digitalWrite(LED1, false);
  digitalWrite(LED2, false);
  digitalWrite(LED3, false);
  if(c == 'red')
    digitalWrite(LED1, true);
  else if(c == 'green')
    digitalWrite(LED2, true);
  else if(c == 'blue')
    digitalWrite(LED3, true);

  // or:
  // console.log(sensor.getValue());
  // prints: { red:..., green:..., blue:... }
}, 200);

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.