2nd Relay with no power
Posted: Sat Sep 28, 2013 9:58 am
I just uploaded the following code to my RA+ and none of the equipment is working. I tried resetting the controller by unplugging it and reconnecting it. When I reconnected it the red light on the controller kept flashing until I disconnected the relay expansion module from the expansion hub and reset the controller.
Code: Select all
[quote]
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <[color=#CC6600]Wire[/color].h>
#include <[color=#CC6600]OneWire[/color].h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <[color=#006699]LED[/color].h>
#include <RA_TempSensor.h>
#include <[color=#006699]Relay[/color].h>
#include <RA_PWM.h>
#include <[color=#006699]Timer[/color].h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <[color=#006699]Salinity[/color].h>
#include <[color=#006699]RF[/color].h>
#include <[color=#006699]IO[/color].h>
#include <[color=#006699]ORP[/color].h>
#include <[color=#006699]AI[/color].h>
#include <[color=#006699]PH[/color].h>
#include <[color=#006699]WaterLevel[/color].h>
#include <[color=#CC6600]ReefAngel[/color].h>
[color=#7E7E7E]////// Place global variable code below here[/color]
[color=#7E7E7E]////// Place global variable code above here[/color]
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
[color=#7E7E7E]// This must be the first line[/color]
[color=#CC6600]ReefAngel[/color].[color=#CC6600]Init[/color](); [color=#7E7E7E]//Initialize controller[/color]
[color=#7E7E7E]// Ports toggled in Feeding Mode[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port6Bit[/color] | [color=#006699]Port8Bit[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePortsE[/color][0] = [color=#006699]Port3Bit[/color] | [color=#006699]Port4Bit[/color];
[color=#7E7E7E]// Ports toggled in Water Change Mode[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port3Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port5Bit[/color] | [color=#006699]Port6Bit[/color] | [color=#006699]Port7Bit[/color] | [color=#006699]Port8Bit[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePortsE[/color][0] = [color=#006699]Port4Bit[/color];
[color=#7E7E7E]// Ports toggled when Lights On / Off menu entry selected[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPorts[/color] = [color=#006699]Port2Bit[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPortsE[/color][0] = [color=#006699]Port1Bit[/color];
[color=#7E7E7E]// Ports turned off when Overheat temperature exceeded[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port3Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port5Bit[/color] | [color=#006699]Port6Bit[/color] | [color=#006699]Port7Bit[/color] | [color=#006699]Port8Bit[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPortsE[/color][0] = [color=#006699]Port3Bit[/color];
[color=#7E7E7E]// Use T1 probe as temperature and overheat functions[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]TempProbe[/color] = [color=#006699]T1_PROBE[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]OverheatProbe[/color] = [color=#006699]T1_PROBE[/color];
[color=#7E7E7E]// Set the Overheat temperature setting[/color]
[color=#CC6600]InternalMemory[/color].[color=#CC6600]OverheatTemp_write[/color]( 840 );
[color=#7E7E7E]// Ports that are always on[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port1[/color] );
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port8[/color] );
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Box1_Port3[/color] );
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Box1_Port8[/color] );
[color=#7E7E7E]////// Place additional initialization code below here[/color]
[color=#7E7E7E]////// Place additional initialization code above here[/color]
}
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]()
{
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port2[/color],9,0,21,10 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port3[/color],9,0,21,30 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port4[/color],9,0,21,30 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]WavemakerRandom1[/color]( [color=#006699]Port5[/color],30,100 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]WavemakerRandom2[/color]( [color=#006699]Port6[/color],30,100 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardHeater[/color]( [color=#006699]Port7[/color],778,784 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Box1_Port1[/color],9,0,21,40 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Box1_Port4[/color],9,0,21,0 );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 0, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,100,0) );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 1, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,100,0) );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 2, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,100,2) );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 3, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,75,0) );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 4, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,75,0) );
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]SetChannel[/color]( 5, [color=#CC6600]PWMParabola[/color](9,0,21,0,0,60,3) );
[color=#7E7E7E]////// Place your custom code below here[/color]
[color=#CC6600]if[/color] (hour()<9 || hour()>=21)
{
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]Off[/color]([color=#006699]Port5[/color]);
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]Off[/color]([color=#006699]Port6[/color]);
}
[color=#7E7E7E]////// Place your custom code above here[/color]
[color=#7E7E7E]// This should always be the last line[/color]
[color=#CC6600]ReefAngel[/color].[color=#CC6600]Portal[/color]( [color=#006699]"Rodasphoto"[/color] );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]ShowInterface[/color]();
}
[color=#CC6600]void[/color] DrawCustomMain()
{
[color=#CC6600]int[/color] x,y;
[color=#CC6600]char[/color] text[10];
[color=#7E7E7E]// Dimming Expansion[/color]
x = 15;
y = 2;
[color=#CC6600]for[/color] ( [color=#CC6600]int[/color] a=0;a<6;a++ )
{
[color=#CC6600]if[/color] ( a>2 ) x = 75;
[color=#CC6600]if[/color] ( a==3 ) y = 2;
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color]( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,[color=#006699]"Ch :"[/color] );
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color]( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawText[/color]( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]GetChannelValue[/color](a) );
y += 10;
}
[color=#CC6600]pingSerial[/color]();
[color=#7E7E7E]// Parameters[/color]
#if defined DisplayLEDPWM && ! defined RemoveAllLights
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawMonitor[/color]( 15, 39, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color],
[color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]GetDaylightValue[/color](), [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]GetActinicValue[/color]() );
#else [color=#7E7E7E]// defined DisplayLEDPWM && ! defined RemoveAllLights[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawMonitor[/color]( 15, 39, [color=#CC6600]ReefAngel[/color].[color=#006699]Params[/color] );
#endif [color=#7E7E7E]// defined DisplayLEDPWM && ! defined RemoveAllLights[/color]
[color=#CC6600]pingSerial[/color]();
[color=#7E7E7E]// Main Relay Box[/color]
[color=#CC6600]byte[/color] TempRelay = [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayData[/color];
TempRelay &= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOff[/color];
TempRelay |= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOn[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawOutletBox[/color]( 12, 76, TempRelay );
[color=#CC6600]pingSerial[/color]();
[color=#7E7E7E]// Relay Expansion[/color]
TempRelay = [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayDataE[/color][0];
TempRelay &= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOffE[/color][0];
TempRelay |= [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#006699]RelayMaskOnE[/color][0];
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawOutletBox[/color]( 12, 96, TempRelay );
[color=#CC6600]pingSerial[/color]();
[color=#7E7E7E]// Date and Time[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]LCD[/color].[color=#CC6600]DrawDate[/color]( 6, 122 );
[color=#CC6600]pingSerial[/color]();
}
[color=#CC6600]void[/color] DrawCustomGraph()
{
}
[/quote]