Reefology's code


Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Mon Jan 05, 2015 4:23 pm
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 <Humidity.h>
#include <DCPump.h>
#include <PAR.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
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on
    ReefAngel.Relay.On( Port8 );

    ////// Place additional initialization code below here
   
    ReefAngel.DDNS( "" );

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.DosingPumpRepeat1( Port1 );
    ReefAngel.MoonLights( Port2 );
    ReefAngel.ActinicLights( Port3 );
    ReefAngel.DayLights( Port4 );
    ReefAngel.WavemakerRandom( Port5,119,1200 );
    ReefAngel.WavemakerRandom( Port6,99,1000 );
    ReefAngel.StandardHeater( Port7 );
    ////// Place your custom code below here
   

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "" );
    ReefAngel.DDNS( "" ); // Your DDNS is
    ReefAngel.ShowInterface();
}
Last edited by Reefology on Fri Oct 13, 2017 4:55 am, edited 2 times in total.
Image

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Mon Jan 05, 2015 4:25 pm
so should i take the jebao port offline? well it isn't working anyway :D
Image
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Mon Jan 05, 2015 4:53 pm
Just set it to always on, or plug it into a power strip. Let the stock Jebao controller handle the pump, unless you want to use a Jebao cable to control it with the RA.

You also need to remove this line:

Code: Select all
ReefAngel.DDNS( "Reefology" ); // Your DDNS is Reefology-tank.myreefangel.com


You already have a DDNS declaration in setup(). That's probably why you're having issues with your phone app.

--Colin

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Mon Jan 05, 2015 4:58 pm
great Colin, will do. But you might want to note that i didnt manually add it, was done by the wizard.

I also wanted to add password authentication but havent' figured out how, can you help me with that? I'm aware i won't be able to use the iphone app until its supported.

thanks
Image
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Mon Jan 05, 2015 5:48 pm
Must have been an evil Wizard. Voldemort is my guess. ;)

I don't use the password authentication. Maybe someone else can chime in. I do know you won't be able to use the iPhone app if you enable it.

--Colin
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jan 05, 2015 5:51 pm
Add this in setup

ReefAngel.Network.WifiAuthentication("username:password");

Change username and password for whatever you'd like it to be.

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Mon Jan 05, 2015 6:14 pm
great thanks, i forgot Roberto had already given it to me just couldn't find it.
Image

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Thu Jan 08, 2015 10:53 am
Added this custom code that i copied from anothher user but not getting desired result. Can someone explain each section so i can learn the code and make adjustments going forward please?

FYI, i changed ''if (now()%SECS_PER_DAY==600'' from 0 to 600 hoping to change mode every 10 mins.

Code: Select all
static int rmode;
    static boolean changeMode=true;


    // These are the modes we can cycle through. You can add more and even repeat...
    byte modes[] = { ReefCrest, Lagoon, Constant, TidalSwell, ShortPulse, Sine, LongPulse, Else, Gyre };

    if (now()%SECS_PER_DAY==600 || changeMode==true) { // Change every 10 mins or if controller rebooted
    rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
    changeMode=false;
    }

    // Set timer when in feeding mode
    static unsigned long feeding;
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
   
    if (now()-feeding<3600) {
    // Continue NTM for the 60 minutes
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=NutrientTransport;
    } else if (now()%SECS_PER_DAY<43200 || now()%SECS_PER_DAY>=79200) { // 12pm / 10pm
    // Night mode (go to 30%)
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=Sine;
    ReefAngel.DCPump.Speed=30;
    } else if (InternalMemory.DCPumpMode_read()==11) {
    // Custom Mode and nothing else going on
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
    } else {
    ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
    }
Last edited by Reefology on Fri Jan 16, 2015 9:06 am, edited 2 times in total.
Image
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Jan 08, 2015 11:00 am
What desired behavior are you trying to get and what behavior are you seeing instead..

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Thu Jan 08, 2015 12:52 pm
thanks for the quick response. I have a single WP40 and would like to have alternate wave modes that change throughout each day, I'd like a calm mode at night running at 30% or less if possible (but not sure it is), I'd like to override via internal memory if possible and then have it revert back to random after a set time (but not a must have).

I like the way it kicks into night mode and feed mode but it doesnt alternate wave patterns listed in the code its stuck in else mode.

Thanks
Image
Next

Return to Ask anything here

Who is online

Users browsing this forum: No registered users and 3 guests

cron