Need help Urgently (NXT COLOR SENSOR)
Posted: 10 Nov 2011, 14:36
Hello Fellow NXT lovers.
I have an issue i am unable to solve on my own, I have tried many times but each time failed.
I have come to a stage where im actually dreaming up code to fix it in my sleep! (allways fails mind you)
Here is my issue: (im sorry if i do not make sence)
I wish to use the NXT color sensor (3 led RGB) to do the following task:
Constantly read in RGB and Ambiant light values and place into an array as follows:
int global_color[INPUT_NO_OF_COLORS];
task color_read_task()
{
TextOut(20, LCD_LINE1, "Start");
int rgb[INPUT_NO_OF_COLORS];
int normed[INPUT_NO_OF_COLORS];
int scaled[INPUT_NO_OF_COLORS];
}
}
Ok this works fine (i think) It has placed the 4 values read from the Sensor into the int global_color[] array. Perfect!
Now here is the bit im stuck on..
I want to be able to "create" two new colors seperate from the standerd 6 NXT sensors read (red, blue, black, yellow, green, white), I wish to see "Turquoise" and one called "carpet".
So i have written the following to set the RGBL values for turquoise:
bool isTerquoise()
{
int turquoise[INPUT_NO_OF_COLORS];
turquoise[INPUT_RED] = 490;
turquoise[INPUT_GREEN] = 533;
turquoise[INPUT_BLUE] = 540;
turquoise[INPUT_BLANK] = 900;
}
Now then, I know the above works and tells the robot (when its called as below) when its hit the carpet or a turquoise block...
task block_search()
{
TextOut(20, LCD_LINE2, "Block Search");
}
}
the MAJOR problem here is that the Values:
turquoise[INPUT_RED] = 490;
turquoise[INPUT_GREEN] = 533;
turquoise[INPUT_BLUE] = 540;
turquoise[INPUT_BLANK] = 900;
Are every so close to the white values:
R: 610
G: 550
B: 550
N: 110 && 990
For some odd reason the Robot says it has seen the Turquoise color when its actually still on the white mat!
I have a feeling that the values are riseing up and down all the time and in sence hit the values i dont want them to hit untill its over the block...
is there any way what so ever to fix it so that the robot can distinguish White from turquoise?
Any help is greatly appreciated.
many thanks
PD
I have an issue i am unable to solve on my own, I have tried many times but each time failed.
I have come to a stage where im actually dreaming up code to fix it in my sleep! (allways fails mind you)
Here is my issue: (im sorry if i do not make sence)
I wish to use the NXT color sensor (3 led RGB) to do the following task:
Constantly read in RGB and Ambiant light values and place into an array as follows:
int global_color[INPUT_NO_OF_COLORS];
task color_read_task()
{
TextOut(20, LCD_LINE1, "Start");
int rgb[INPUT_NO_OF_COLORS];
int normed[INPUT_NO_OF_COLORS];
int scaled[INPUT_NO_OF_COLORS];
}
}
Ok this works fine (i think) It has placed the 4 values read from the Sensor into the int global_color[] array. Perfect!
Now here is the bit im stuck on..
I want to be able to "create" two new colors seperate from the standerd 6 NXT sensors read (red, blue, black, yellow, green, white), I wish to see "Turquoise" and one called "carpet".
So i have written the following to set the RGBL values for turquoise:
bool isTerquoise()
{
int turquoise[INPUT_NO_OF_COLORS];
turquoise[INPUT_RED] = 490;
turquoise[INPUT_GREEN] = 533;
turquoise[INPUT_BLUE] = 540;
turquoise[INPUT_BLANK] = 900;
}
Now then, I know the above works and tells the robot (when its called as below) when its hit the carpet or a turquoise block...
task block_search()
{
TextOut(20, LCD_LINE2, "Block Search");
}
}
the MAJOR problem here is that the Values:
turquoise[INPUT_RED] = 490;
turquoise[INPUT_GREEN] = 533;
turquoise[INPUT_BLUE] = 540;
turquoise[INPUT_BLANK] = 900;
Are every so close to the white values:
R: 610
G: 550
B: 550
N: 110 && 990
For some odd reason the Robot says it has seen the Turquoise color when its actually still on the white mat!
I have a feeling that the values are riseing up and down all the time and in sence hit the values i dont want them to hit untill its over the block...
is there any way what so ever to fix it so that the robot can distinguish White from turquoise?
Any help is greatly appreciated.
many thanks
PD