hi, i am a beginner in programming. i have a problem and any help will be very much appreciated.
i am trying to program a color sensor where a variable is incremented whenever it detects the same color.
(example is if it detects a green, x will be incremented by one.)
my code is like this:
string sColor;
int x=0;
while(1)
{
switch (SensorValue[color])
{
case GREENCOLOR:
sColor = "Green";
x = x+1;
break;
default:
sColor = "???";
break;
}
nxtDisplayCenteredTextLine(2, sColor);
wait1Msec(50);
}
but i'm not getting the output that i want.
whenever it sees a green, x is always incrementing continuously.
i want it to only increase by 1 one at a time in every detection.
(i apologize for my grammar :] )
can anyone help me with this. thanks a lot.

jamekz~