feeding mode code

Do you have a question on how to do something.
Ask in here.
Post Reply
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

feeding mode code

Post by rossbryant1956 »

I am having trouble getting my feeding mode to work again since installing my new relays. Here is a snippet of my code:

Code: Select all

   // Define Relay Ports by Name
    #define DT_LightsOne       1
    #define DT_LightsTwo       2
    #define Unused3            3
    #define Unused4            4
    #define DT_LWM             5
    #define GT_LWM             6
    #define Unused7            7
    #define Unused8            8

    #define Unused11           Box1_Port1
    #define Unused12           Box1_Port2
    #define GT_LightsOne       Box1_Port3
    #define GT_LightsTwo       Box1_Port4
    #define DT_RWM             Box1_Port5
    #define GT_RWM             Box1_Port6
    #define DT_Heat            Box1_Port7
    #define DT_Pump            Box1_Port8
    
    #define RV_Heat            Box2_Port1
    #define RV_Pump            Box2_Port2
    #define GT_Heat            Box2_Port3
    #define Unused24           Box2_Port4
    #define GT_OverFill        Box2_Port5
    #define GT_Fill            Box2_Port6
    #define Skimmer            Box2_Port7
    #define GT_Pump            Box2_Port8

    void setup() {
        ReefAngel.Init();  //Initialize controller
        ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items)); // Initialize the menu
        ReefAngel.FeedingModePortsE[0] = DT_Pump; // Turn off on Box1 when feeding mode is activated is activated
        ReefAngel.FeedingModePortsE[1] = Skimmer | GT_Pump; // Turn off on Box2 when feeding mode is activated is activated
        ReefAngel.WaterChangePorts = DT_LWM | GT_LWM ; // Turn off when water change mode is activated
        ReefAngel.WaterChangePortsE[0] = DT_RWM | GT_RWM | DT_Heat | DT_Pump; // Turn off on Box1 when water change mode is activated
        ReefAngel.WaterChangePortsE[1] = GT_Heat | GT_Pump | Skimmer | GT_Fill | RV_Heat; // Turn off on Box1 when water change mode is activated
        
The ports that need to be toggled are on relay boxes 1 & 2: box1_port8 and box2_port8. The ports it is switching are: Box2_port1, box2_port3, and box2_port5. I haven't tested the water change mode but it will probably act the same way. Here is the code snippet I call feeding mode with.

Code: Select all

// if the hour is 2p or 8p, minute is 55 and seconds is 0, start the feeding mode
          if ( ((hour() == 14) || (hour() == 20)) &&
          (minute() == 55) &&
          (second() == 0) )
          {
          ReefAngel.FeedingModeStart();
          }   
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: feeding mode code

Post by lnevo »

So you have three relay boxes or two?

The FeedingModePortsE[0] is the first expansion box. The main relay box is still FeedingModePorts
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: feeding mode code

Post by rossbryant1956 »

I have three, there are no devices on the first relay that need switching. should i do a line like FeedingModePort=0 and then my other lines? For some reason it is getting confused. Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: feeding mode code

Post by lnevo »

Ahh i see the problem.

You dont use the relay port number for that (ie 1-8, 11-18, 21-28)

You need to use Port1Bit and Port2Bit and so forth.

The PortXBit is the same whether its Box1 or Box2 or main relay box.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: feeding mode code

Post by rossbryant1956 »

thx so much. I'll fix it in the next day or so.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Post Reply