Newb needs help

Do you have a question on how to do something.
Ask in here.
Post Reply
abfranklin3
Posts: 8
Joined: Sun Jul 21, 2013 3:20 pm

Newb needs help

Post by abfranklin3 »

First, I apologize for asking a question that has probably been asked a million times. I've searched and searched the forums and have yet to find any answer to my specific problem. It probably doesn't help that I'm a total newb to writing code, so I probably wouldn't recognize the answer if I saw it... I just received a Jebao WP40 along with the Reef Angel cable to connect to my RA controller. I can't seem to get the Jebao to work though. It just plain doesn't do anything when connected to my RA via the cable.

Two questions:

I first should double check where to plug the cable into on the RA? I'm assuming the ATO Port? Does it matter which one?

Next, if it's plugged in correctly then it must be my code. Please help. Just in case, I do not have any expansion modules.
abfranklin3
Posts: 8
Joined: Sun Jul 21, 2013 3:20 pm

Re: Newb needs help

Post by abfranklin3 »

Apparently I either don't know or don't have the access to post my code....
abfranklin3
Posts: 8
Joined: Sun Jul 21, 2013 3:20 pm

Re: Newb needs help

Post by abfranklin3 »

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

////// Place global variable code below here

void DrawCustomMain()
{
byte offset = 3;
byte waterLevel = ReefAngel.WaterLevel.GetLevel();
byte dispLights = ReefAngel.PWM.GetDaylightValue();
byte sumpLights = ReefAngel.PWM.GetActinicValue();
byte TempRelay = ReefAngel.Relay.RelayData;
byte atoPort = 3;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
char text[10];


// Header = Title + Date and Time
ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor, 35, offset, "Allan's Reef");
ReefAngel.LCD.DrawDate(6, offset + 10);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, offset + 20, 128, offset + 20);
offset = 26;
pingSerial();

// Main Relay Box & Parameters
ReefAngel.LCD.DrawCircleOutletBoxHorizontal(2, offset, TempRelay);
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 50, offset, "Temp:");
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_PURPLE, 255, 49, offset + 9, text, Font8x16);
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 101, offset, "pH:");
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_ORANGE, 255, 93, offset + 9, text, Font8x16);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, offset + 23, 128, offset + 23);
offset = offset + 27;
pingSerial();

// Lights
if (dispLights > 0)
ReefAngel.LCD.DrawText(COLOR_GREEN, DefaultBGColor, 10, offset, "Display");
else
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor, 10, offset, "Display");
if (sumpLights > 0)
ReefAngel.LCD.DrawText(COLOR_GREEN, DefaultBGColor, 72, offset, "Refugium");
else
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor, 72, offset, "Refugium");
ConvertNumToString(text, dispLights, 1);
strcat(text, "%");
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, DefaultBGColor, 15, offset + 9, text, Font8x16);
ConvertNumToString(text, sumpLights, 1);
strcat(text, "%");
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, DefaultBGColor, 95, offset + 9, text, Font8x16);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, offset + 24, 128, offset + 24);
offset = offset + 27;
pingSerial();


// Water Level & ATO
if (waterLevel >= 100)
{
ReefAngel.LCD.DrawText(COLOR_BLUE, DefaultBGColor, 5, offset, "Tank Level");
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, DefaultBGColor, 25, offset + 9, "Full", Font8x16);
}
else if (waterLevel >= 50)
{
ReefAngel.LCD.DrawText(COLOR_ORANGE, DefaultBGColor, 5, offset, "Tank Level");
ConvertNumToString(text, waterLevel, 1);
strcat(text, "%");
ReefAngel.LCD.Clear(DefaultBGColor, 1, offset + 9, 128, offset + 18);
ReefAngel.LCD.DrawLargeText(COLOR_ORANGE, DefaultBGColor, 25, offset + 9, text, Font8x16);
}
else
{
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor, 5, offset, "Tank Level");
ConvertNumToString(text, waterLevel, 1);
strcat(text, "%");
ReefAngel.LCD.DrawLargeText(COLOR_RED, DefaultBGColor, 25, offset + 9, text, Font8x16);
}
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 70, offset + 2, "ATO:");
if (ReefAngel.LowATO.IsActive())
{
ReefAngel.LCD.DrawText(COLOR_GREEN, DefaultBGColor, 95, offset + 2, "Avail");
}
else
{
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor, 95, offset + 2, "Empty");
}
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 72, offset + 12, "Pump:");
if ((TempRelay&(1<<(atoPort - 1)))==1<<(atoPort - 1))
{
ReefAngel.LCD.Clear(DefaultBGColor, 102, offset + 12, 128, offset + 21);
ReefAngel.LCD.DrawText(COLOR_GREEN, DefaultBGColor, 102, offset + 12, "On");
}
else
{
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor, 102, offset + 12, "Off");
}
ReefAngel.LCD.Clear(COLOR_BLACK, 1, offset + 24, 128, offset + 24);
offset = offset + 27;
pingSerial();

// Wavemaker
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 8, offset, "Jebao Mode");
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, 95, offset, "Speed");
ReefAngel.LCD.DrawLargeText(COLOR_ORANGE, DefaultBGColor, 5, offset + 9, "Reef Crest", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_GREEN, DefaultBGColor, 98, offset + 9, "XX%", Font8x16);

}

void DrawCustomGraph()

{

}

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

/*
Ports assignment:

Port1 - ATO
Port2 - Refugium Light
Port3 - Actinic Fixture
Port4 - Daylight fixture
Port5 - Powerhead
Port6 -
Port7 - Heater
Port8 -
*/

void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller

ReefAngel.PHMin=520;
ReefAngel.PHMax=801;

// 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 = Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port7Bit;
// 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 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;

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

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


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

void loop()
{
ReefAngel.DosingPumpRepeat( Port1,0,120,20); // Add water for 20 seconds every 120 minutes with 0 minutes offset
ReefAngel.StandardLights( Port2,19,30,9,30 );
ReefAngel.StandardLights( Port3,9,30,19,30 );
ReefAngel.StandardLights( Port4,10,0,19,0 );
ReefAngel.StandardHeater( Port7,751,761 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( ReefCrest,30,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here




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

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

Re: Newb needs help

Post by rimai »

It connects to dimming ports on relay box and not to the ATO ports.
Roberto.
abfranklin3
Posts: 8
Joined: Sun Jul 21, 2013 3:20 pm

Re: Newb needs help

Post by abfranklin3 »

Thanks! I actually tried that too and forgot to mention. The Jebao still didn't work plugged into the relay box, so it must be in the code I guess. Any suggestions?
abfranklin3
Posts: 8
Joined: Sun Jul 21, 2013 3:20 pm

Re: Newb needs help

Post by abfranklin3 »

Figured it out!

Changed my code to this:

void loop()
{
ReefAngel.DosingPumpRepeat( Port1,0,120,20); // Add water for 20 seconds every 120 minutes with 0 minutes offset
ReefAngel.StandardLights( Port2,19,30,9,30 );
ReefAngel.StandardLights( Port3,9,30,19,30 );
ReefAngel.StandardLights( Port4,10,0,19,0 );
ReefAngel.StandardLights( Port5,10,0,19,0 );
ReefAngel.StandardHeater( Port7,751,761 );
////// Place your custom code below here

ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% +/- 20% on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(80,20,false) ); // ReefCrest at 80% +/- 20% on anti-sync mode


////// Place your custom code above here
Post Reply