Best way to build my coding?

New members questions
Post Reply
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Best way to build my coding?

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post by rimai »

I think you should start with RAGen:
http://forum.reefangel.com/viewtopic.php?f=15&t=60
Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

So last night RAGen was working fine, but today when I click on it it wont open.
Seedlessone
Posts: 132
Joined: Tue Jan 24, 2012 6:20 pm

Re: Best way to build my coding?

Post 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.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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();
}
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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?
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

Or should I build my code with 4 and 5 not used, then add in the code above?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post 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.
Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

Oh ok i thought 4-5 were the fast toggle relays
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

One of the reason I want to alter the settings is for the random flow between 15-35 seconds.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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();
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post 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();
}


Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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!!!!!
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post by rimai »

Glad to help :)
Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

hmmm say m y sketch is too big
Seedlessone
Posts: 132
Joined: Tue Jan 24, 2012 6:20 pm

Re: Best way to build my coding?

Post by Seedlessone »

Might try leaving out the data time feature in ragen. Seems it takes up quite a bit of space.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post by rimai »

Use the simple menu feature.
It'll reduce quite a lot, actually.
Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post by ingtar_shinowa »

I am in that arent i?
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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?
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Best way to build my coding?

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Best way to build my coding?

Post by rimai »

Make sure the paths are set correctly too, like the earlier post:
http://forum.reefangel.com/viewtopic.php?p=5291#p5291
Roberto.
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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
ingtar_shinowa
Posts: 20
Joined: Fri Jan 27, 2012 9:14 pm

Re: Best way to build my coding?

Post 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
Post Reply