Where to put additional code
Posted: Thu Dec 27, 2012 11:43 pm
Hello all! I just ordered my RA yesterday and can't wait to get it! I should have added the wifi and PWM dimming expansions, but some stuff on eBay hasn't sold yet, so they'll be about a week behind, but I will go ahead and get the programming down (hopefully, experts here willing
) for all of it. In the future, the RF and salinity expansions will be coming, but all of that in due time.
A bit about my tank. It's 80g (48x24x16), and I've got two MP10wES in the tank for flow. I really wish I had repaired my third one instead of selling it off. Oh well. My sump is a 40B (but probably gonna change it to a series of 10/20g tanks) with a section containing a powerful algae scrubber and the other section housing about 20 gallons of macros. All is LED-lit, the main tank has a four-channel full spectrum array run on Meanwel ELN-60-48P, and the algae scrubber and fuge have deep red/royal blue based arrays run on Meanwell LPC-35-700. I'm also running a reactor for Purigen and Rox 0.8 carbon.
I went ahead and generated a code via the RA Wizard, and here's what I got:
There are a few things that I want to add on top of that, but, frankly, I'm not sure how. I'd say I'm tech savvy, but when it comes to Arduino code, I know pretty much nothing.
I would like to rename the ports on the relay so I can remember which is which.
I would like to do sunrise/sunset based on location. I'd like to use the sunrise/sunset times for the Great Barrier Reef, but adjusted for my time zone (so length of day is the same as the GBR). (I can't post links or I'd link the thread)
I would like to do weather effects with clouds on all channels but lightning only on channels 0 and 2, if that's possible.
I would like to do moon phase using one of the RA moonlight units (I think that is built in to the code I have above, maybe?)
I would like to have the option to force cloud cover and a storm from the menu.
That's all I can really think of for now. If anyone can lend a hand in how to modify the existing codes for that stuff and where the code should go I'd appreciate it! This is all new to me and is very confusing!
A bit about my tank. It's 80g (48x24x16), and I've got two MP10wES in the tank for flow. I really wish I had repaired my third one instead of selling it off. Oh well. My sump is a 40B (but probably gonna change it to a series of 10/20g tanks) with a section containing a powerful algae scrubber and the other section housing about 20 gallons of macros. All is LED-lit, the main tank has a four-channel full spectrum array run on Meanwel ELN-60-48P, and the algae scrubber and fuge have deep red/royal blue based arrays run on Meanwell LPC-35-700. I'm also running a reactor for Purigen and Rox 0.8 carbon.
I went ahead and generated a code via the RA Wizard, and here's what I got:
Code: Select all
#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port7Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 820 );
// Ports that are always on
ReefAngel.Relay.On( Port1 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port2,300 );
ReefAngel.StandardLights( Port3,21,0,9,0 );
ReefAngel.StandardLights( Port4,18,0,12,0 );
ReefAngel.DosingPumpRepeat( Port5,0,60,60 );
ReefAngel.DosingPumpRepeat( Port6,30,60,60 );
ReefAngel.StandardLights( Port7,6,0,21,0 );
ReefAngel.DosingPumpRepeat( Port8,0,30,60 );
ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,19,0,12,60,12) );
ReefAngel.PWM.SetChannel( 1, PWMParabola(8,0,21,0,12,100,12) );
ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,19,0,12,75,12) );
ReefAngel.PWM.SetChannel( 3, PWMParabola(8,0,20,0,12,100,12) );
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
ReefAngel.PWM.SetChannel( 5, MoonPhase() );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "jedimasterben" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 84, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
There are a few things that I want to add on top of that, but, frankly, I'm not sure how. I'd say I'm tech savvy, but when it comes to Arduino code, I know pretty much nothing.
I would like to rename the ports on the relay so I can remember which is which.
I would like to do sunrise/sunset based on location. I'd like to use the sunrise/sunset times for the Great Barrier Reef, but adjusted for my time zone (so length of day is the same as the GBR). (I can't post links or I'd link the thread)
I would like to do weather effects with clouds on all channels but lightning only on channels 0 and 2, if that's possible.
I would like to do moon phase using one of the RA moonlight units (I think that is built in to the code I have above, maybe?)
I would like to have the option to force cloud cover and a storm from the menu.
That's all I can really think of for now. If anyone can lend a hand in how to modify the existing codes for that stuff and where the code should go I'd appreciate it! This is all new to me and is very confusing!