Range as Variable?

I am working on a line-following type project, but with many functions and colors. Basically, I want to set a range of values read by a photodiode as ranges, like 475-500 is black, 25-50 is white, 75-100 is green, etc... to keep my program from becoming too cluttered and so I can easily make sense of it later. Plus, I have 2 photodiodes reading and I have many if loops that look for a color on either sensor, and I can't clearly define them individually if they are ranges. Does anyone have suggestions about how I could go about this? I thought about an array but they seem more like math functions than variable declaration.

It sounds like your problem is similar to putting multiple buttons on one analog pin. Here's an example of doing that; you should be able to base your code on this without too much trouble.


Good luck!