Led<-- Fixed and now to get clouds and lightning working

Basic / Standard Reef Angel hardware
Post Reply
dbmet
Posts: 235
Joined: Thu Nov 10, 2011 11:49 am

Led<-- Fixed and now to get clouds and lightning working

Post by dbmet »

I got my led lights hooked up to the relay expansion box. I can dim them using the iphone app. However I was expecting that when they turned on they would slowly ramp up the intensity however they just stay at whatever I set them to earlier..

Heres my code

#define Fan 8
#define LightWhite 7
#define Main Pump 6
#define Skimmer 5
#define Heater 4
#define Powerhead 3
#define ATO 2
#define LightBlue 1

#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
#define CUSTOM_MAIN
#define CUSTOM_VARIABLES



#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 <ReefAngel.h>

////// Place global variable code below here
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
char text[8];


// Parameters
ReefAngel.LCD.DrawDate(6, 2);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();

ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,12,16,"Daryls 90 Reef",
Font8x8);



pingSerial();

ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 90, "--------------------");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 126, "--------------------");
ReefAngel.LCD.DrawText(COLOR_RED,255,56,110, "ATO");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 93, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 103, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 113, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 123, "|");
ReefAngel.LCD.DrawText(COLOR_INDIGO,255, 45, 111, "H");
ReefAngel.LCD.DrawText(COLOR_INDIGO,255, 45, 121, "I");
ReefAngel.LCD.DrawText(COLOR_INDIGO,255, 77, 111, "L");
ReefAngel.LCD.DrawText(COLOR_INDIGO,255, 77, 121, "O");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 93, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 103, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 113, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 123, "|");


ReefAngel.LCD.DrawText(COLOR_RED,255,10,30,"TANK");
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_PURPLE, 255, 10, 40, text, Num8x16);


ReefAngel.LCD.DrawText(COLOR_RED,255,100,30,"pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_PURPLE, 255, 85, 40, text, Num8x16);

pingSerial();

byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 77, TempRelay);

pingSerial();
if (ReefAngel.HighATO.IsActive())
ReefAngel.LCD.FillCircle(57,122,3,COLOR_RED);
else
ReefAngel.LCD.FillCircle(57,122,3,COLOR_GREEN);

if (ReefAngel.LowATO.IsActive())
ReefAngel.LCD.FillCircle(70,122,3,COLOR_RED);
else
ReefAngel.LCD.FillCircle(70,122,3,COLOR_GREEN);

ReefAngel.LCD.DrawText(0,255,8,100, "WLED");
ReefAngel.LCD.DrawText(COLOR_BLACK,255,15,119,
ReefAngel.PWM.GetDaylightValue());

ReefAngel.LCD.DrawText(0,255,88,100, "BLED");
ReefAngel.LCD.DrawText(COLOR_BLACK,255,90,119,
ReefAngel.PWM.GetActinicValue());


}
void DrawCustomGraph()
{
}

////// Place global variable code above here


void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.AddStandardMenu();
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port5Bit | Port6Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port4Bit;
// 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 );
InternalMemory.ATOExtendedTimeout_write(120);


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

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


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

void loop()
{
ReefAngel.ActinicLights( LightBlue );
ReefAngel.SingleATOLow( Port2 );
if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off (Port2);
ReefAngel.StandardLights( LightWhite );
ReefAngel.StandardFan( Port8 );
ReefAngel.StandardHeater( Port4 );
ReefAngel.Relay.DelayedOn( Port5 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
////// Place your custom code below here


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

// This should always be the last line
ReefAngel.Portal( "dbmet");
ReefAngel.ShowInterface();
}
Last edited by dbmet on Sat Oct 20, 2012 6:34 pm, edited 1 time in total.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Led

Post by rimai »

They are supposed to.
Was it doing it when you had hard coded values?
Roberto.
dbmet
Posts: 235
Joined: Thu Nov 10, 2011 11:49 am

Led

Post by dbmet »

Didn't have it hooked up yet when I had hard coded values. Guess I can try that and see what happens
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Led

Post by rimai »

Before you do that, please check if your memory settings are correct.
Memory locations 249-254

Code: Select all

#define Mem_B_PWMSlopeStartD      VarsStart+49
#define Mem_B_PWMSlopeEndD	      VarsStart+50
#define Mem_B_PWMSlopeDurationD   VarsStart+51
#define Mem_B_PWMSlopeStartA      VarsStart+52
#define Mem_B_PWMSlopeEndA	      VarsStart+53
#define Mem_B_PWMSlopeDurationA   VarsStart+54
Roberto.
dbmet
Posts: 235
Joined: Thu Nov 10, 2011 11:49 am

Re: Led

Post by dbmet »

249 10
250 85
251 60
252 15
253 95
254 60
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Led

Post by rimai »

Yes, that should work then.
It should start the ramp at 10% and go to 85% for daylight and 15% to 95% for actinic.
It will follow the Parabola waveform and will start and end at the same time your daylight schedule.
Roberto.
dbmet
Posts: 235
Joined: Thu Nov 10, 2011 11:49 am

Re: Led<---Fixed now to get clouds and lightning working

Post by dbmet »

Dimming works beautifully..
Will I be able to use the tutorial for the clouds and lightening if I'm using the internal memory now?


http://forum.reefangel.com/viewtopic.php?f=14&t=288
Image
Post Reply