ขาย GY-31 TCS230 TCS3200 Color Sensor ราคาที่ดีที่สุด
5
8
การให้คะแนน
9
ขายแล้ว
฿115
ยี่ห้อ | No Brand(ไม่มียี่ห้อ) |
---|---|
เรือจาก | จังหวัดฉะเชิงเทรา |
รายละเอียดสินค้า
GY-31TCS230 TCS3200 Color Sensor เซนเซอร์วัดค่าสี
A breakout board for the TCS320 colour sensor which also includes white LEDs for reflective illumination. The TCS230 colour sensor combines configurable silicon photodiodes and a current-to-frequency converter on a single monolithic CMOS integrated circuit. The full-scale output frequency of this colour sensor can be scaled by one of three preset values via two control input pins. This TCS230 colour sensor comes with digital input and output which allows direct interface to a microcontroller or other logic circuitry.
Note: LED's are not controllable, sensor is sensitive to infra-red light.
Specification
Chip: TCS230
Input Voltage: 3V ~ 5V
Best Detection Range: 10mm
High-resolution conversion of light intensity to frequency
Programmable colour and full-scale output frequency
Communicate directly with a microcontroller
Low-profile surface mount package
PCB Size (L x W): Approx. 1.2 x 0.95 inch
Pinout and example arduino sketch available after purchase.
Code:
// TCS230 pins connected to Arduino
//int s0 = D3; esp8266
//int s1 = D4;
//int s2 = D5;
//int s3 = D6;
//int out = D7;
int s0 = 2; //nano
int s1 = 3;
int s2 = 4;
int s3 = 5;
int out = 6;
// Variables
int red = 0;
int green = 0;
int blue = 0;
void setup()
{
Serial.begin(115200);
pinMode(s0, OUTPUT);
pinMode(s1, OUTPUT);
pinMode(s2, OUTPUT);
pinMode(s3, OUTPUT);
pinMode(out, INPUT);
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
}
void loop()
{
color();
Serial.print(" R");
Serial.print(red, DEC);
Serial.print(" G");
Serial.print(green, DEC);
Serial.print(" B");
Serial.print(blue, DEC);
delay(600);
if (red
{
if (red
Serial.println("WHILE");
} else{
Serial.println(" -> (Red Color)");
}
}
else if (blue
{
if (red
Serial.println("WHILE");
}else {
Serial.println(" -> (Blue Color)"); }
}
else if (red > green green > blue green > 11 )
{
if (red
Serial.println("WHILE");
} else{
Serial.println(" -> (Green Color)"); }
}
else{
Serial.println();
}
}
void color()
{
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
//count OUT, pRed, RED
red = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);
digitalWrite(s3, HIGH);
//count OUT, pBLUE, BLUE
blue = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);
digitalWrite(s2, HIGH);
//count OUT, pGreen, GREEN
green = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH);
}