Page 1 of 1

Best way to build my coding?

Posted: Sat Jan 28, 2012 10:27 pm
by ingtar_shinowa
I want to have some very basic function as well as some greater functions. For now im looking to build a refugium schedule, basic ATO heaters pump skimmer, reactors, and wavemaker:

Code: Select all

    void setup()
    {
       randomSeed(analogRead(0));
        ReefAngel.Init();  //Initialize controller   
        ReefAngel.Timer[1].SetInterval(random(15,35));
        ReefAngel.Timer[1].Start(); 
        ReefAngel.Relay.On(Port5);
    }

    void loop()
    {
        ReefAngel.ShowInterface();

    if ( ReefAngel.Timer[1].IsTriggered() )
          {
            ReefAngel.Timer[1].SetInterval(random(15,35));
            ReefAngel.Timer[1].Start();
            ReefAngel.Relay.Toggle(Port5);
            ReefAngel.Relay.Toggle(Port6);
           }
    }
Should I build my PDE piece-mail then put it all together with custom port names?

Also how would i put in a menu item for changing media for my reactors?

Sorry for the beginner post but im not a big programming guy.

Re: Best way to build my coding?

Posted: Sat Jan 28, 2012 11:32 pm
by rimai
I think you should start with RAGen:
http://forum.reefangel.com/viewtopic.php?f=15&t=60

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 2:40 pm
by ingtar_shinowa
So last night RAGen was working fine, but today when I click on it it wont open.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 3:01 pm
by Seedlessone
I had the same problem with RAGEN. Try this....

It's because the paths are wrong.
Try this then:
1. Download the static version:
https://github.com/downloads/curtbinder ... static.zip
2. Try running is as administrator
3. Make sure to go to menu Edit->Settings
4. Set the path of the folders to the following:
Sketch: Documents\Arduino
Libraries: Documents\Arduino\libraries
Arduino: C:\Program Files\Reef Angel Controller
5. Click Ok.
6. You can now delete the static version if you want to.

I hope this works now.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 3:40 pm
by ingtar_shinowa
Figured it out. My anti virus was interfearing.

The code I made is ato on 1, return pump on 2, skimmer on 3, powerheads 4&5, reactors on 6, heaters on 7, and fuge lights on 8.

For H2O/reactor change with simple menu I turn off ATo, skimmer, return, and reactor pump.

Feed mode just turns off my main powerheads.

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (01/29/2012 15:35)
// RA_012912_1535.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DirectTempSensor
#define SaveRelayState
#define SIMPLE_MENU
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
    ReefAngel.Init();  //Initialize controller

    ReefAngel.FeedingModePorts = B00011000;
    ReefAngel.WaterChangePorts = B00100111;
    ReefAngel.OverheatShutoffPorts = B00000000;
    ReefAngel.LightsOnPorts = B00000000;

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

void loop()
{
    // Specific functions
    ReefAngel.StandardATO(Port1);
    ReefAngel.Relay.DelayedOn(Port3, 5);
    ReefAngel.Wavemaker1(Port4);
    ReefAngel.Wavemaker2(Port5);
    ReefAngel.Relay.DelayedOn(Port6, 5);
    ReefAngel.StandardHeater(Port7);
    ReefAngel.StandardLights(Port8);

	ReefAngel.ShowInterface();
}

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 3:42 pm
by ingtar_shinowa
Now in order to insert the wavemaker code into this set up do I need to mess with the memory setting? I just put in the standard setting which I need to change to work reverse lighting on the fuge light since with the RAGen code it works off memory?

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 3:44 pm
by ingtar_shinowa
Or should I build my code with 4 and 5 not used, then add in the code above?

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 4:39 pm
by rimai
The wavemaker code is already in there:

Code: Select all

    ReefAngel.Wavemaker1(Port4);
    ReefAngel.Wavemaker2(Port5);
But I would strongly recommend you putting the wavemakers on ports 5 and 6 by generating it again with RAGen.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 5:04 pm
by ingtar_shinowa
Oh ok i thought 4-5 were the fast toggle relays

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 5:05 pm
by ingtar_shinowa
One of the reason I want to alter the settings is for the random flow between 15-35 seconds.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 5:08 pm
by ingtar_shinowa
OK here it is swapped around

1 ATO
2 Return
3 Skimmer
4 Reactors
5 left flow
6 right flow
7 heaters
8 fuge light

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (01/29/2012 17:07)
// RA_012912_1707.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DirectTempSensor
#define SaveRelayState
#define SIMPLE_MENU
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
    ReefAngel.Init();  //Initialize controller

    ReefAngel.FeedingModePorts = B00110000;
    ReefAngel.WaterChangePorts = B00001111;
    ReefAngel.OverheatShutoffPorts = B01000000;
    ReefAngel.LightsOnPorts = B00000000;

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

void loop()
{
    // Specific functions
    ReefAngel.StandardATO(Port1);
    ReefAngel.Relay.DelayedOn(Port3, 5);
    ReefAngel.Relay.DelayedOn(Port4, 5);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.StandardHeater(Port7);
    ReefAngel.StandardLights(Port8);

	ReefAngel.ShowInterface();
}

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 5:20 pm
by rimai
Ok, if you want the random action, I updated your code for your reference:

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (01/29/2012 17:07)
// RA_012912_1707.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
 #define DisplayImages
 #define DateTimeSetup
 #define VersionMenu
 #define DirectTempSensor
 #define SaveRelayState
 #define SIMPLE_MENU
 */


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
  ReefAngel.Init();  //Initialize controller

  ReefAngel.FeedingModePorts = B00110000;
  ReefAngel.WaterChangePorts = B00001111;
  ReefAngel.OverheatShutoffPorts = B01000000;
  ReefAngel.LightsOnPorts = B00000000;

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

  randomSeed(analogRead(0));
  ReefAngel.Timer[1].SetInterval(random(15,35));
  ReefAngel.Timer[1].Start(); 
  ReefAngel.Relay.On(Port5);

}

void loop()
{
  // Specific functions
  ReefAngel.StandardATO(Port1);
  ReefAngel.Relay.DelayedOn(Port3, 5);
  ReefAngel.Relay.DelayedOn(Port4, 5);
  ReefAngel.StandardHeater(Port7);
  ReefAngel.StandardLights(Port8);
  if ( ReefAngel.Timer[1].IsTriggered() )
  {
    ReefAngel.Timer[1].SetInterval(random(15,35));
    ReefAngel.Timer[1].Start();
    ReefAngel.Relay.Toggle(Port5);
    ReefAngel.Relay.Toggle(Port6);
  }



  ReefAngel.ShowInterface();
}



Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 6:25 pm
by ingtar_shinowa
Roberto you are my favorite!!! I've been following this idea of yours since the beginning but I took the plunge because of the great support you and others put into this community! Thanks again for the help!!!!!

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 6:58 pm
by rimai
Glad to help :)

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 9:00 pm
by ingtar_shinowa
hmmm say m y sketch is too big

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 9:55 pm
by Seedlessone
Might try leaving out the data time feature in ragen. Seems it takes up quite a bit of space.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 10:17 pm
by ingtar_shinowa
Binary sketch size: 31196 bytes (of a 30720 byte maximum)

doesnt matter how many feature i pull out it say the same thing.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 10:18 pm
by ingtar_shinowa
I fin this a little frustrating seeing how much other people are doing with their units. I have to be doing something wrong.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 10:19 pm
by rimai
Use the simple menu feature.
It'll reduce quite a lot, actually.

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 10:25 pm
by ingtar_shinowa
I am in that arent i?

Re: Best way to build my coding?

Posted: Sun Jan 29, 2012 10:51 pm
by ingtar_shinowa
DO I need to wipe my memory file and reload it with less 'stuff' in it, the things i dont need (MH lighting, dosing, etc), in order to lower my sketch size?

Re: Best way to build my coding?

Posted: Mon Jan 30, 2012 5:48 am
by binder
No, the memory file just sets the values to the Internal Memory for use with the sketch / program files later on.

The more things you enable in the Features file (Features Tab in the program), the larger the sketch size will be.
Date & Time Setup requires a lot of space, so it's advised to not include it.
Simple Menu reduces a lot of space, so it's advised to use it.

If you are using the Client Suite or any of the monitoring applications (Android, iPhone/iPad apps or Status App), you must have wifi enabled for communications with the controller. Wifi does require a lot of space.

Bottom line, the more stuff you have the controller do, the larger the sketch size will be.

Re: Best way to build my coding?

Posted: Mon Jan 30, 2012 8:24 am
by rimai
Make sure the paths are set correctly too, like the earlier post:
http://forum.reefangel.com/viewtopic.php?p=5291#p5291

Re: Best way to build my coding?

Posted: Mon Jan 30, 2012 8:38 am
by ingtar_shinowa
SO WIERD! I don't understand why now when I complie it 24274 bytes but last night compling the same code is was 31k

Re: Best way to build my coding?

Posted: Mon Jan 30, 2012 9:40 am
by ingtar_shinowa
Its ALIVE! Thanks everyone for you help. I did run RAGen static and the seemed to fix all my issues. The other download seemed to wrok for a few start ups than never again lol. /shrug