My code - now with RAnet

Share you PDE file with our community

Posts: 151
Joined: Wed Mar 13, 2013 5:36 pm
PostPosted: Fri Jan 23, 2015 4:43 pm
lnevo wrote:Sorry for the late reply. Please try this code.

Code: Select all
    #include <SoftwareSerial.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 <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>
    /*
    #define Heater      1
    #define Return      2
    #define             3
    #define Skimmer     4
    #define Vortech1    5
    #define Vortech2    6
    #define ATO         7
    #define Sump Light  8
    */
    ////// Place global variable code below here
byte vtechmode, vtSpeed, vtDuration;
    ////// 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 = Port2Bit;
        // ReefAngel.FeedingModePortsE[0] = 0;
        // Ports toggled in Water Change Mode
        // ReefAngel.WaterChangePorts = Port7Bit | Port4Bit | Port5Bit | Port6Bit;
        // ReefAngel.WaterChangePortsE[0] = 0;
        // Ports toggled when Lights On / Off menu entry selected
        // ReefAngel.LightsOnPorts = 0;
        // ReefAngel.LightsOnPortsE[0] = 0;
        // Ports turned off when Overheat temperature exceeded
        ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
        // ReefAngel.OverheatShutoffPortsE[0] = 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( 830 );
        ReefAngel.AddRANet();


        // Ports that are always on
        ReefAngel.Relay.On( Port2 );
        ReefAngel.Relay.On( Port3 );
        ReefAngel.Relay.On( Port4 );
        ReefAngel.Relay.On( Port5 );
        ReefAngel.Relay.On( Port6 );
        ReefAngel.Relay.On( Box1_Port1 );
        ReefAngel.Relay.On( Box1_Port2 );
        ReefAngel.Relay.On( Box1_Port3 );
        ReefAngel.Relay.On( Box1_Port4 );
        ReefAngel.Relay.On( Box1_Port5 );
        ReefAngel.Relay.On( Box1_Port6 );
        ReefAngel.Relay.On( Box1_Port7 );
        ReefAngel.Relay.On( Box1_Port8 );
     

        ////// Place additional initialization code below here
       
        // Hardcode calibrations
       // ReefAngel.PHMin=576; // PH7.0
       // ReefAngel.PHMax=842; // PH10.0
      //  ReefAngel.SalMax=3300; // 35ppt
        ////// Place additional initialization code above here
    }

    void loop()
    {
    vtechmode=InternalMemory.RFMode_read();
    vtSpeed=InternalMemory.RFSpeed_read();
    vtDuration=InternalMemory.RFDuration_read();

    static unsigned long feeding;
    ReefAngel.StandardHeater( Port1,778,782 );
        ReefAngel.WaterLevelATO( Port7,180,71,74 );
        ReefAngel.StandardLights( Port8,15,0,2,0 );
        ReefAngel.PWM.SetChannel( 0,PWMSlope(19,00,21,00,15,51,20,0) );  //MOON
        ReefAngel.PWM.SetChannel( 1,PWMSlope(12,30,20,00,15,50,30,0) );  //RB
        ReefAngel.PWM.SetChannel( 2,PWMSlope(12,20,20,00,15,95,30,0) ); //WHITE
        ReefAngel.PWM.SetChannel( 3,PWMSlope(12,15,20,00,15,70,30,0) );  //BLUE&CYAN
        ReefAngel.PWM.SetChannel( 4,PWMSlope(12,00,20,30,15,70,30,0) ); //UV
       
        if ( ReefAngel.HighATO.IsActive())
        {
          ReefAngel.Relay.On(Port2);
        }
        else
        {
          ReefAngel.Relay.Off(Port2);
        }
ReefAngel.RF.UseMemory=true;
/*       
if (hour() >=13 && hour() < 20)
      {
        // if (ReefAngel.RF.Mode==Night) ReefAngel.RF.SetMode(Feeding_Stop,0,0);
        ReefAngel.RF.UseMemory=true;
        // ReefAngel.RF.SetMode(ReefCrest,60,20);
            if (ReefAngel.DisplayedMenu==FEEDING_MODE)
            {
             feeding=now();
             }
             if (now()-feeding<5400) {
            // if (now()-feeding > 1 && now()-feeding < 5400) { // 1 second after feeding mode until 90 minutes after feeding mode.
  ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Smart_NTM,75,10);
    }
           }
      else
      {
        ReefAngel.RF.UseMemory=false;
        ReefAngel.RF.SetMode(Constant,10,0);
       }
         if (vtechmode!=InternalMemory.RFMode_read())
          InternalMemory.RFMode_write(vtechmode);
         if (vtSpeed!=InternalMemory.RFSpeed_read())
          InternalMemory.RFSpeed_write(vtSpeed);
         if (vtDuration!=InternalMemory.RFDuration_read())
          InternalMemory.RFDuration_write(vtDuration);
*/
        // This should always be the last line
        ReefAngel.Portal( "bencollinz" );
        ReefAngel.ShowInterface();
    }
   
     void DrawCustomMain()
    {
      char text[7];
        // Date and Time
        ReefAngel.LCD.DrawDate( 6, 2 );
        ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
        pingSerial();

    ReefAngel.LCD.DrawText(0,255,18,12,"EcoSmart Vortech");
  ReefAngel.LCD.Clear(255, 1, 19, 128, 29);
  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,21,"Constant");
  else if (vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,21,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,21,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,21,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,21,"Long Pulse");
  else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,21,"Nutrient Trnsp.");
  else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,21,"Tidal Swell");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,21,"Night");

  ReefAngel.LCD.DrawText(0,255,4,30,"RF Speed:");
  ReefAngel.LCD.Clear(255,59,29,128,39);
  ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor,71,31,vtSpeed);
  ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor,90,31,"/");
  ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor,100,31,vtDuration);
 
  ReefAngel.LCD.DrawText(0,255,10,40,"Salt");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIANRED, 255, 10, 50, text, Num8x8);
  pingSerial();

 /* ReefAngel.LCD.DrawText(0,255,50,40,"Fresh");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIANRED, 255, 50, 50, text, Num8x8);
  pingSerial();
*/
  ReefAngel.LCD.DrawText(0,255,100,40,"pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(COLOR_PLUM, 255, 85, 50, text, Num8x8);
  pingSerial();

  ReefAngel.LCD.DrawText(0,255,13,58,"Salinity");
  ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
  ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN, 255, 13, 68, text, Num8x8);
  pingSerial();

  // water level
    ReefAngel.LCD.DrawText(0,255,68,58,"WL");
    ReefAngel.LCD.DrawText( COLOR_CORNFLOWERBLUE,255, 68, 68, ReefAngel.WaterLevel.GetLevel() );
    pingSerial();

       // Main Relay Box
        byte TempRelay = ReefAngel.Relay.RelayData;
        TempRelay &= ReefAngel.Relay.RelayMaskOff;
        TempRelay |= ReefAngel.Relay.RelayMaskOn;
        ReefAngel.LCD.DrawOutletBox( 12, 108, TempRelay );
        pingSerial();
         // Relay Expansion
        TempRelay = ReefAngel.Relay.RelayDataE[0];
        TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
       TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
       ReefAngel.LCD.DrawOutletBox( 12, 120, TempRelay );
        pingSerial();
     
    }
   
    void DrawCustomGraph()
    {
    }
    /* void Heater2(byte HeaterRelay, int LowTemp, int HighTemp)
    {
    if (ReefAngel.Params.Temp[T2_PROBE] == 0) return; // Don't turn the heater on if the temp is reading 0
    if (ReefAngel.Params.Temp[T2_PROBE] <= LowTemp && ReefAngel.Params.Temp[T2_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay); // If sensor 2 temperature <= LowTemp - turn on heater
    if (ReefAngel.Params.Temp[T2_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay); // If sensor 2 temperature >= HighTemp - turn off heater
    }
    void Heater1(byte HeaterRelay, int LowTemp, int HighTemp)
    {
    if (ReefAngel.Params.Temp[T1_PROBE] == 0) return; // Don't turn the heater on if the temp is reading 0
    if (ReefAngel.Params.Temp[T1_PROBE] <= LowTemp && ReefAngel.Params.Temp[T1_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay); // If sensor 2 temperature <= LowTemp - turn on heater
    if (ReefAngel.Params.Temp[T1_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay); // If sensor 2 temperature >= HighTemp - turn off heater
    }
    */

Made the change, no difference.
20150123_184023.jpg
20150123_184023.jpg (244.58 KiB) Viewed 6481 times

stays at 100% until feeding mode exits
Image

Posts: 151
Joined: Wed Mar 13, 2013 5:36 pm
PostPosted: Fri Jan 23, 2015 4:53 pm
and I can't even remove the RAnet code without getting this error

"C:\Users\user\Documents\Arduino\libraries\Globals/Globals.h:348: error: 'SoftwareSerial' does not name a type"
Image
User avatar
Posts: 5339
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sat Jan 24, 2015 5:42 am
Maybe need to reinstall the libraries fresh, something doesnt seem right

Posts: 12166
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Jan 24, 2015 9:30 am
If you remove RANet, you must also remove the include on top "#include <SoftwareSerial.h>"
Roberto.

Posts: 151
Joined: Wed Mar 13, 2013 5:36 pm
PostPosted: Thu Sep 24, 2015 5:14 am
rimai wrote:If you remove RANet, you must also remove the include on top "#include <SoftwareSerial.h>"



How do I use
Code: Select all
ReefAngel.StandardHeater( Port1,778,782 );
but Box1_Port1? The same way?
Image

Posts: 151
Joined: Wed Mar 13, 2013 5:36 pm
PostPosted: Thu Sep 24, 2015 6:09 am
bencollinz wrote:
rimai wrote:If you remove RANet, you must also remove the include on top "#include <SoftwareSerial.h>"



How do I use
Code: Select all
ReefAngel.StandardHeater( Port1,778,782 );
but Box1_Port1? The same way?


figured it out. yes, the same way.
Image
Previous

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 1 guest