Need Help promming my AI sols and Ecotech radion

Do you have a question on how to do something.
Ask in here.
Post Reply
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Need Help promming my AI sols and Ecotech radion

Post by ecam »

Can someone post sample codes on how to control the aforememtnioned lights using the RA plus...

Thank you
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need Help promming my AI sols and Ecotech radion

Post by rimai »

Did you try the wizard?
Roberto.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Need Help promming my AI sols and Ecotech radion

Post by ecam »

Yes i did. But i cant not get any of the functionality to show up on my display and i cannot control the blue and whites on the AI. I also cant get full functionality of the VOrtech while we are talking.

Sample codes would be really helpful to see how it all works. Thanks Roberto

rimai wrote:Did you try the wizard?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need Help promming my AI sols and Ecotech radion

Post by rimai »

Can you post your code?
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need Help promming my AI sols and Ecotech radion

Post by rimai »

There is an example code in File->Sketchbook->Example Codes->CustomMain_AquaIllumination.
Roberto.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Need Help promming my AI sols and Ecotech radion

Post by ecam »

here is my current code. I went back to this b\c the wizard code was not working correctly






#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <RF.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 <ReefAngel.h>

// Globals Needed for RF Mode on Custom Main
byte vtechmode;
boolean bFeeding=false;


void setup()
{
ReefAngel.Init(); // Initialize Controller
ReefAngel.AddStandardMenu();
ReefAngel.AddDateTimeMenu();
ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3, 4 and 7 when overheat occurs
ReefAngel.RF.SetMode( NutrientTransport,85,10 );
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T3_PROBE;
ReefAngel.OverheatProbe = T3_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit| Port5Bit; // Turn on/off Ports 3 and 4 when Light On/Off menu option is selected





// Ports that are always on
ReefAngel.Relay.On( Port1 ); // Return Pump





// Hardcode PH calibrations
ReefAngel.PHMin=544; // PH7.0
ReefAngel.PHMax=830; // PH10.0


}

void loop()
{
ReefAngel.LCD.DrawLargeText(COLOR_STEELBLUE,COLOR_WHITE,28,121,"Edwin's Reef"); // Display Reef Angel banner


//Light instructions
ReefAngel.StandardLights( Port2,19,15,7,4 );//Refugium
ReefAngel.StandardLights(Port3,7,5,19,15); // T5s - High Noon
ReefAngel.StandardLights(Port4,9,5,17,0); // AI Sols - Regular
ReefAngel.StandardLights(Port5,9,5,17,0); // Ecotech Radions - MH
ReefAngel.StandardHeater( Port7,780,800 );
ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer

//Light instructions (Start Hr,Min, End Hr, Min)
//ReefAngel.Wavemaker1(Port5); // Wavemaker 1
//ReefAngel.Wavemaker2(Port6); // Wavemaker 2



ReefAngel.PWM.StandardDaylight(); // Dimming for Daylight Channel
ReefAngel.PWM.StandardActinic(30); // Dimming for Actinic Channel


//-------------------------------------------------------- Start RF Nightmode Control ---------------------------------------------
if (hour()>=23 || hour()<7) // Defining "Nightmode" hours for VorTech = between 11 PM and 7 AM
{
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
vtechmode = 9;
}
else
{
ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
ReefAngel.RF.UseMemory=true;
vtechmode = InternalMemory.RFMode_read();
}
ReefAngel.ShowInterface();
//---------------------------------------------------------- End RF Nightmode Control ---------------------------------------------
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need Help promming my AI sols and Ecotech radion

Post by rimai »

That doesn't have the aqua illumination code in it.
It's not even a code that the wizard would output.
Go through the wizard and generate a code and make sure you enable the aqua illumination and RF expansion module.
Roberto.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Need Help promming my AI sols and Ecotech radion

Post by ecam »

Okay Roberto... Here is the code from the wizard....
Now how do I show the current setting of my vortechs on my display and how can i toggle modes rfrom the controller\iphone app.

#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>fa
#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.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
ReefAngel.TempProbe = T3_PROBE;
ReefAngel.OverheatProbe = T3_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 820 );

// Setup ATO Port for AI communication
ReefAngel.AI.SetPort( lowATOPin );


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


////// Place additional initialization code below here


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

void loop()
{
ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) );
ReefAngel.StandardLights( Port3,11,0,15,0 );
ReefAngel.StandardLights( Port4,11,0,20,0 );
ReefAngel.StandardLights( Port5,9,0,19,0 );
ReefAngel.StandardHeater( Port7,780,800 );
ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
ReefAngel.AI.SetChannel( White, PWMParabola(11,0,17,0,0,60,0) );
ReefAngel.AI.SetChannel( Blue, PWMParabola(9,0,20,0,15,100,15) );
ReefAngel.AI.SetChannel( RoyalBlue, MoonPhase() );
ReefAngel.RF.UseMemory = false;
ReefAngel.RF.SetMode( NutrientTransport,85,10 );
ReefAngel.RF.SetChannel( Radion_White, PWMParabola(9,0,20,0,0,60,0) );
ReefAngel.RF.SetChannel( Radion_RoyalBlue, MoonPhase() );
ReefAngel.RF.SetChannel( Radion_Red, PWMParabola(9,0,20,0,15,65,15) );
ReefAngel.RF.SetChannel( Radion_Green, PWMParabola(9,0,20,0,15,50,15) );
ReefAngel.RF.SetChannel( Radion_Blue, MoonPhase() );
ReefAngel.RF.SetChannel( Radion_Intensity, PWMParabola(9,0,20,0,15,94,15) );
if ( second()==0 ) ReefAngel.RF.RadionWrite();


////// Place your custom code below here





// Hardcode PH calibrations
ReefAngel.PHMin=544; // PH7.0
ReefAngel.PHMax=830; // PH10.0

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

// This should always be the last line
ReefAngel.Portal( "ecam" );
ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
int x,y;
char text[10];
// Aqua Illumination
x = 10;
y = 20;
ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x,y,"WH:" );
ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+38,y,"BL:" );
ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+76,y,"RB:" );
for ( int a=0;a<3;a++ )
{
ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+18,y,ReefAngel.AI.GetChannel(a) );
x += 38;
}
pingSerial();

// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
pingSerial();

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Need Help promming my AI sols and Ecotech radion

Post by ecam »

Roberto, also in the last 10 mins my controller has rebooted itself 5x times. itll flash red while doing it and then start up again. THe main problem is that my skimmer keeps turning off and on
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need Help promming my AI sols and Ecotech radion

Post by rimai »

Your code is set to hard coded settings so you can't change any settings with smart phone app.
You would need to choose internal memory setting when generating your code.
To display the modes in the controller screen, you will need to create a custom main screen.
There are several other users that have done custom screens to display vortech mode.
It will display automatically on the smart phone apps or Portal.
Roberto.
Post Reply