Range of numbers

In order to use our optical sensor for moving motors, we’re opting to use hue numbers rather than absolute colors. The issue i am having is that i do not know how to express a range of numbers (350 - 360 for example). Does this call for the use of an array or something else? Ill attach some code i have written up to try to explain it better.

int array[11] = {350, 351, 352, 353, 354,355, 356,357,358,359,360};

if (Optical2.isNearObject()){
if(Optical2.hue() == array[9]){

   Brain.Screen.print("I see red ");

}

}

Do something like this:

If((sensor.getvalue() < 600) and (sensor.getvalue() > 200)){
Print(“color is red”)
} else {
Print(“color is not red”)
}

Sorry, on my phone

3 Likes