Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.16 KB

TCS3200.md

File metadata and controls

46 lines (37 loc) · 1.16 KB

TCS3200 driver

  • KEYWORDS: Module,TCS3200,YL64,YL-64,color,colour,sensor,detect,RGB,light

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);