RGB Colour Intensity Reading of Any Object
Sensor Name:- TCS3200
Tis post have the code for reading the color intensity RGB color of any object.
To demonstarte this i use a color sensor and ardunio uno board
All Project of Arduino UNO Board
Pin Details:-
Pin 4 Ardunio uno board is connect to RED line of Sensor
Pin 5 Ardunio uno board is connect to GREEN line of SensorPin 6 Ardunio uno board is connect to BLUE line of Sensor
#define Red 4
#define Green 5
#define Blue 6
char inputs [20];
char oldInputs [20];
void setup()
{
Serial.begin(9600);
}
void getInputs()
{
sprintf(inputs,"SS:%03X:%03X:03X",analogRead(Red),analogRead(Green),analogRead(Blue));
}
void loop()
{
getInputs();
if(strcmp(inputs,oldInputs)!=0)
{
strcpy(oldInputs,inputs);
Serial.println(inputs);
}
if(Serial.available())
{
int ind=0;
char buff[5];
while(Serial.available())
{
unsigned char c=Serial.read();
buff[ind]=c;
if(ind++>4)
break;
}
}
}
Check Also This post:-SQL BETWEEN OPERATOR Programming Logic and Code with Syntax