Page 1 of 1
PWM control channel levels
Posted: Mon Apr 15, 2013 5:06 pm
by Rodasphoto
I just built a radion pro clone and have 6 channels of lights and was wondering if there is a way to adjust each channel to my liking without having to load new code to the controller with preset values? Or is there a way to set the color temp by preset for instance 10K, 12k, 14k, etc.
Re: PWM control channel levels
Posted: Tue Apr 16, 2013 7:58 am
by rimai
There is no color temp preset, but you can play around with each channel using the portal or android app or web browser.
You can use this code to make things simpler:
Code: Select all
ReefAngel.PWM.SetChannel(0,InternalMemory.PWMSlopeEnd0_read());
ReefAngel.PWM.SetChannel(1,InternalMemory.PWMSlopeEnd1_read());
ReefAngel.PWM.SetChannel(2,InternalMemory.PWMSlopeEnd2_read());
ReefAngel.PWM.SetChannel(3,InternalMemory.PWMSlopeEnd3_read());
ReefAngel.PWM.SetChannel(4,InternalMemory.PWMSlopeEnd4_read());
ReefAngel.PWM.SetChannel(5,InternalMemory.PWMSlopeEnd5_read());
Re: PWM control channel levels
Posted: Tue Apr 16, 2013 12:31 pm
by Rodasphoto
So do I just change the internal memory to what I want using the portal or do I have to use both the portal and the code. The RA controller gets better and better the more I learn about it.
Re: PWM control channel levels
Posted: Tue Apr 16, 2013 12:36 pm
by rimai
If you use the above code, you can simply go to the portal and change the settings.
You will see the controller changing the % as you apply the changes.
It will be picking up the end% of the memory settings, so make sure you change the end% in the portal.
Re: PWM control channel levels
Posted: Wed Apr 17, 2013 12:31 pm
by Rodasphoto
So my sketch should look like this?
Code: Select all
#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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
// 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 );
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port2,9,0,21,5 );
ReefAngel.StandardLights( Port3,9,0,21,0 );
ReefAngel.StandardLights( Port4,9,0,21,0 );
ReefAngel.WavemakerRandom( Port5,30,100 );
ReefAngel.WavemakerRandom( Port6,30,100 );
ReefAngel.StandardHeater( Port7,778,781 );
ReefAngel.PWM.SetChannel(0,InternalMemory.PWMSlopeEnd0_read());
ReefAngel.PWM.SetChannel(1,InternalMemory.PWMSlopeEnd1_read());
ReefAngel.PWM.SetChannel(2,InternalMemory.PWMSlopeEnd2_read());
ReefAngel.PWM.SetChannel(3,InternalMemory.PWMSlopeEnd3_read());
ReefAngel.PWM.SetChannel(4,InternalMemory.PWMSlopeEnd4_read());
ReefAngel.PWM.SetChannel(5,InternalMemory.PWMSlopeEnd5_read());
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Rodasphoto" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, 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, 84, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
I have never coded anything in Arduino and am trying to make heads or tails of everything.
Re: PWM control channel levels
Posted: Wed Apr 17, 2013 1:19 pm
by rimai
Yeap... looks good
