Enums are not what you think they are. Use Google and review them. They are NOT meant as aliases for
arbitrary numerical values. The various states an Enum type can take on have an integer value of the order they appear in the definition unless explicitly specified as you did, but that doesn't mean the undefined gaps don't exist.
So 1 = Array, 2 = Water, 3 = Pool and so on. 1 and Array can basically be used interchangeably and mean the same thing. So:
Water = 2 = 1 + 1 = Array + 1
In your case, you explicitly specify the equivalent enumerated values:
Array = 0x0
Water = 0x1
Pool = 0xC
Have you noticed your logical misstep yet? Pool = 0xC, not 0x2. Water + 1 = 0x2. So of course it won't equal to Pool. You can't have it both ways.
This is what has happened to your enum definitions:
{Array, Water, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Pool}
So when you go Water +1, you end up at the first undefined state, not at Pool.
What you need is an array_name[] = {0x0, 0x1, 0xC} where your for loop steps through the INDEX of the array ([0], [1], [2]) and write the value being contained in that particular array element (i.e. 0x0, 0x1, 0xC).
Then if you want to use english names, apply those names to the array indexes using #defines, constants, or enums.
Code:
unsigned ADC_Ch[] = {0x0, 0x1, 0xC}; //located in array indexes 0, 1, 2, respectively
const unsigned Array = 0; //so you can use english names when referring to array elements
const unsigned Water = 1; //you can also use #defines similarly but this is more dangerous since they can apply when they shouldn't if you aren't careful
const unsigned Pool = 2;
//ADC_Ch[Array] same as ADC_Ch[0]
//ADC_Ch[Water] same as ADC_Ch[1]
//ADC_Ch[Pool] same as ADC_Ch[2]
You can also use enums to refer to the array elements:
Code:
enum English_Index = {Array, Water, Pool};
English_Index This_Index
This_Index = Array; //or Water or Pool depending on whether you want 0, 1, or 2
ADC_Ch[This_Index]; //have to work through the enum variable. Can't directly do something like ADC_Ch[Water]