I did not look at your code very carefully but one thing jumped out:
Code:
void CamAnOut (void)
{
Threshold threshold(RH, RL, GH, GL, BH, BL);
I believe you have reversed the High and Low numbers. It should be:
Code:
void CamAnOut (void)
{
Threshold threshold(RL, RH, GL, GH, BL, BH);