I think what you missing is this piece of information:
The are 3 byte variables for relay calculation. They are RelayData, RelayMaskOn and RelayMaskOff.
The value sent to the relay box is a calculation of these 3 values:
byte TempRelay=RelayData;
TempRelay&=RelayMaskOff;
TempRelay|=RelayMaskOn;
For more information on bitwise comparisons: http://arduino.cc/en/Reference/BitwiseAnd
I'm going to use binary values on all values, just to make it easy to understand, but you can look at this to understand more about how to convert them: http://arduino.cc/en/Reference/IntegerConstants
Relay 1 is the least significant bit.
RelayData: byte value that represents which relays should be on or off.
Examples:
ReefAngel.Relay.RelayData=B00101011;
In this line, you are telling the controller to turn on relays 1,2,4,6 and turn off relays 3,5,7,8
ReefAngel.Relay.RelayData=B11100000;
In this line, you are telling the controller to turn on relays 6,7,8 and turn off relays 1,2,3,4,5
RelayMaskOn: byte value that represents which relays should be overridden to always on. This mask is going to be compared to RelayData with OR comparison.
Examples:
ReefAngel.Relay.RelayMaskOn=B00000000;
In this line, you are telling the controller to not override any relay to always on. They are all going to be in auto.
ReefAngel.Relay.RelayMaskOn=B00001000;
In this line, you are telling the controller to override relay 4 to always on.
ReefAngel.Relay.RelayMaskOn=B01100001;
In this line, you are telling the controller to override relays 1,6,7 to always on.
RelayMaskOff: byte value that represents which relays should be overridden to always off. This mask is going to be compared to RelayData with AND comparison.
Examples:
ReefAngel.Relay.RelayMaskOff=B11111111;
In this line, you are telling the controller to not override any relay to always off. They are all going to be in auto.
ReefAngel.Relay.RelayMaskOff=B11110111;
In this line, you are telling the controller to override relay 4 to always off.
ReefAngel.Relay.RelayMaskOff=B10011110;
In this line, you are telling the controller to override relays 1,6,7 to always off.
After reading this email, I noticed that the mask for turning the MH off is wrong. I'll double check the code when I get home.
It should be:
ReefAngel.Relay.RelayMaskOff=B11111111; //Override MHlight Auto;
ReefAngel.Relay.RelayMaskOff=B11111011; //Override MHlight Off;
Sincerely,
Roberto.