Page 1 of 1

Questions about 2nd relay.....and more

Posted: Thu Mar 08, 2012 1:57 pm
by Neogenesis
Hey all,

Here are the problems I'm having. I'm basing my sketch on the CustomMainScreen_RelayExpansion.....to get my second relay working. I can see it in the Reef Angel client v2.2, and control it, however the outlet configuration is what's puzzling me. I see no specifics for the second relay box in the sketch. Should they be there, and what would be the proper code to define them as "on" for now.

My next question is with the PH probe. Having never used one before, if I upload a new sketch after calibrating, do I need to calibrate again, or is that that something that stays set.

3rd is I', having trouble with the MHlights toggling on and off. The port always sits in the off state, never turning on. I can toggle the port via the client, but it doesn't work automatically. Standard Lights work just fine.

Thanks!!!

Scott

Sketch

Code: Select all

#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <ReefAngel.h>

byte x,y;
char text[10];

void DrawCustomMain()
{
  // the graph is drawn/updated when we exit the main menu &
  // when the parameters are saved
  ReefAngel.LCD.DrawDate(6, 122);
  pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
  pingSerial();
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(12, 104, TempRelay);
}

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph(5, 5);
}

/*
  
 For more information about custom main screen: http://forum.reefangel.com/viewtopic.php?f=14&t=109
 
 To be able to use the custom main screen and salinity, please make sure that you enabled custom main screen and relay expansion on your features file.
 Open RAGen and make sure you have Custom Main Screen and Relay Expansion checked under the Features tab.
 
 Or, you can manually edit the file.
 The file is located at "Documents\Arduino\libraries\ReefAngel_Features.h" file and has to include this line in it:
 
 #define CUSTOM_MAIN
 #define RelayExp
 
 */

void setup()
{
  ReefAngel.Init();  //Initialize controller
  
  ReefAngel.FeedingModePorts = 0;
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.LightsOnPorts = 0;

    // Ports that are always on
    ReefAngel.Relay.On(Port2);
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port4);
    ReefAngel.Relay.On(Port6);
}

void loop()
{
   // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardLights(Port5);
    ReefAngel.StandardLights(Port7);
    ReefAngel.MHLights(Port8);
    ReefAngel.Portal("neogenesis", "***********");
  
  ReefAngel.ShowInterface();
}

Re: Questions about 2nd relay.....and more

Posted: Thu Mar 08, 2012 5:09 pm
by rimai
You can add this to your code:

Code: Select all

    ReefAngel.Relay.On(Box1_Port1);
The pH calibration will not change if you load another sketch. It will change if you upload a new internal memory code though.

Did you check what time you set them to come on and off?

Re: Questions about 2nd relay.....and more

Posted: Thu Mar 08, 2012 10:55 pm
by Neogenesis
Well....the lights worked tonight....not sure what happened last night. Will keep a eye on them.

Thanks for the update on the code......I will give that a shot this weekend.

Scott

Re: Questions about 2nd relay.....and more

Posted: Sat Mar 10, 2012 7:00 am
by binder
If you can toggle them ON and OFF with the client, make sure you set them back to the AUTO mode. If you toggle them ON or OFF, they will remain in the ON or OFF state until you manually put them back into the AUTO mode. The ON/OFF overrides your lighting schedule.

Re: Questions about 2nd relay.....and more

Posted: Sat Mar 10, 2012 7:02 am
by binder
Also, make sure you check out this for the custom main screens (if you have not already). It's got some explanations on how you do things too.
http://forum.reefangel.com/viewtopic.php?f=14&t=109

If anything, it's worth a read as it can give you some more insight on how things work.

Re: Questions about 2nd relay.....and more

Posted: Sat Mar 10, 2012 8:07 pm
by Neogenesis
Curt,

I believe I did just what you said above, I toggled it off, not realizing that I had to set it back to auto. I'll also give that thread a good read, I'm sure it will help out.

Thanks!!!!

Scott