Help with 1st time coding

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
Express Reef
Posts: 51
Joined: Thu Mar 21, 2013 2:19 am
Location: South Africa

Help with 1st time coding

Post by Express Reef »

Good Day All,

Still trying to setup my RA :oops:

I need assistance with my code :mrgreen:

I want a very basic menue
1. Lights on/off (port 1 to 4)
2. Skimmer on/off (port7)
3. Return on/off (port8)
4. Setup - Calibrate pH

Info on Ports
Port 1 - 4 Lights
Port 5 Fans 26.5 on 26 off
Port 6 Heaters 25.5 on 26 off

Light time
Actinic Lights - Port 1
9:15 to 6:15
Daylight Lights Port 2
9:45 to 6:15
Actinic Lights Port 3
10:15 to 7:45
Daylight Lights Port 4
10:45 to 5:45

Here is my code so far but it is not working 100%, my lights does not want to switch on/off via the menu on the controller :evil:

#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 <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.AddStandardMenu();
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit; // Turn on/off Ports 1 and 2 and 3 and 4 when Light On/Off menu option is selected
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 300 );


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

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


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

void loop()
{
ReefAngel.StandardLights( Port1,9,15,18,15 ); // Actinic Lights
ReefAngel.StandardLights( Port2,9,45,18,15 ); // Daylight Lights
ReefAngel.StandardLights( Port3,10,15,19,45 ); // Actinic Lights
ReefAngel.StandardLights( Port4,10,45,17,45 ); // Daylight Lights
ReefAngel.StandardFan( Port5,260,265 );
ReefAngel.StandardHeater( Port6,255,260 );
////// Place your custom code below here


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

// This should always be the last line
ReefAngel.Portal( "Express Reef" );
ReefAngel.ShowInterface(); // Display everything on the LCD screen
}
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help with 1st time coding

Post by rimai »

Code looks good.
Roberto.
User avatar
Express Reef
Posts: 51
Joined: Thu Mar 21, 2013 2:19 am
Location: South Africa

Re: Help with 1st time coding

Post by Express Reef »

Hi Roberto,

My lights was suppose to go off on port 4 20 min ago but it is still on on the controller and did not switch off??? Is my RA faulty??? port 5 & 6 work if the temp goes up or down the the fans go on or heater...
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Help with 1st time coding

Post by lnevo »

Maybe check the time on your RA is set correctly? The code looks right. Did your other lights come on?
User avatar
Express Reef
Posts: 51
Joined: Thu Mar 21, 2013 2:19 am
Location: South Africa

Re: Help with 1st time coding

Post by Express Reef »

Think there was something wrong with the internal memory... got this code now to work... date & time is correct

#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 <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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

ReefAngel.AddStandardMenu(); // Add Standard Menu

// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 300 );


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

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


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

void loop()
{
ReefAngel.StandardLights( Port1,9,15,18,15 );
ReefAngel.StandardLights( Port2,9,45,18,15 );
ReefAngel.StandardLights( Port3,10,15,19,45 );
ReefAngel.StandardLights( Port4,10,45,17,45 );
ReefAngel.StandardFan( Port5,260,265 );
ReefAngel.StandardHeater( Port6,255,260 );
////// Place your custom code below here


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

// This should always be the last line
ReefAngel.ShowInterface();
}
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help with 1st time coding

Post by rimai »

If you clicked on lights on menu, the lights will never turn off.
The lights on is overriding the port to always on.
You need to use lights off to cancel the lights on mode.
I think that's why the port was not working.
Roberto.
Post Reply