I m using RAgen to generate my code and i m having two problems.
Problem number one:
Temperature control is not working properly. I have the fan/chiller on port 2 and the heater on port 3. After I uploaded the code to the controller port 3 turned on and stayed on no matter what the temperature is and port 2 never turned on also no matter what the temperature is. I have chosen temperature display to be in Celcius.
Problem number two:
I have used the code for pwmslope to simulate sunrise and sunset and i have it conflicting with the led pwm control feature that i have checked in RAgen. meaning that after sunsets the lights go to zero then it comes back on to the 50% setting stored in the ledpwm settings
Does that mean that i need to uncheck the ledpwm feature and just include the pwmslope code I have found here on the forum? or does it mean that i adjust the the led pwm setting to zero?
HERE IS MY CODE:
Code: Select all
// Autogenerated file by RAGen (v1.0.4.92), (05/30/2011 23:56)
// RA_053011_2356.pde
//
// This version designed for v0.8.5 Beta 12 or later
/* The following features are enabled for this PDE File:
#define DosingPumpIntervalSetup
#define WavemakerSetup
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
*/
#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>
// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "ahmedess";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "LEDTemp";
prog_char relay1_label[] PROGMEM = "Sump";
prog_char relay2_label[] PROGMEM = "Fan/Chiller";
prog_char relay3_label[] PROGMEM = "Heater";
prog_char relay4_label[] PROGMEM = "Dosers";
prog_char relay5_label[] PROGMEM = "Wavemaker";
prog_char relay6_label[] PROGMEM = "Universal";
prog_char relay7_label[] PROGMEM = "Universal";
prog_char relay8_label[] PROGMEM = "TunzeATO";
PROGMEM const char *webbanner_items[] = {
id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit(1); // set to Celsius Temperature
// Initialize and start the web banner timer
ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
ReefAngel.Timer[4].SetInterval(180); // set interval to 180 seconds
ReefAngel.Timer[4].Start();
ReefAngel.FeedingModePorts = B10000001;
ReefAngel.WaterChangePorts = B10000001;
ReefAngel.OverheatShutoffPorts = B00000000;
ReefAngel.LightsOnPorts = B00000000;
// Ports that are always on
ReefAngel.Relay.On(Port1);
ReefAngel.Relay.On(Port6);
ReefAngel.Relay.On(Port7);
ReefAngel.Relay.On(Port8);
}
void loop()
{
ReefAngel.ShowInterface();
// Specific functions
ReefAngel.StandardFan(Port2);
ReefAngel.StandardHeater(Port3);
ReefAngel.DosingPumpRepeat1(Port4);
ReefAngel.Wavemaker2(Port5);
// Have PWM on from 4p to 1a, with gradual 60 minute ramp up and down starting at the given times
// From 4p to 5p, the PWM will slowly ramp from 20% to 100%
// From 12a to 1a, the PWM will slowly ramp from 100% to 20%
ReefAngel.PWM.SetActinic(PWMSlope(16,0,1,0,20,100,60,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(16,0,1,0,20,100,60,ReefAngel.PWM.GetDaylightValue()));
// Web Banner stuff
if(ReefAngel.Timer[4].IsTriggered())
{
ReefAngel.Timer[4].Start();
ReefAngel.WebBanner();
}
}