Please help me to add and edit my codes please

Do you have a question on how to do something.
Ask in here.

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Wed Nov 23, 2016 7:15 pm
Hi to all! I'm the new guy :)
Could any one Please help me to add and edit my codes please. I got these code from a friend and made it almost work the way I wanted and it's just two things I can't make it work. I just wanted to add On and Off on the port 1 when it is closed, let's say for example when I came home late at night and I wanted to see my tank and if I could make it also opposite of port 1 for sump light or just create another port for sump light. We could just delete the line for "Version" to make a room or any suggestion. Thanks in advance!

Here's my full code bellow and I would like to share it too...


/* The following features are enabled for this File:
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 9
#define PWMEXPANSION
#define CUSTOM_MAIN
#define COLORS_PDE
#define FONT_8x16
*/


#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.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 <ReefAngel.h>

#define Light Actinic 1
#define Light Full sp 2
#define Jebao 3
#define Jecod 4
#define Skimmer 5
#define Return 6
#define Heater 7
#define Fan 8

#include <avr/pgmspace.h>
prog_char menu1_label[] PROGMEM = "Feeding";
prog_char menu2_label[] PROGMEM = "Water Change";
prog_char menu3_label[] PROGMEM = "ATO Clear";
prog_char menu4_label[] PROGMEM = "Overheat Clear";
prog_char menu5_label[] PROGMEM = "PH Calibration";
prog_char menu6_label[] PROGMEM = "Date / Time";
prog_char menu7_label[] PROGMEM = "Version";
prog_char menu8_label[] PROGMEM = "Turn ON Skimmer";
prog_char menu9_label[] PROGMEM = "Turn Off Skimmer";
// Group the menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label,
menu4_label, menu5_label, menu6_label,
menu7_label, menu8_label, menu9_label
};

void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry5()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry6()
{
ReefAngel.SetupDateTime();
}
void MenuEntry7()
{
ReefAngel.DisplayVersion();
}
void MenuEntry8()
{
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry9()
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

//custom dysplay temp+on and off relay
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 6, 2, "Marco's ReefAngel");
ReefAngel.LCD.DrawDate(6, 118);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 17, 132, 17);
pingSerial();
x = 12;
y += MENU_START_ROW+1;
ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Display PH");
char text[7];
ConvertNumToString(text, ReefAngel.Params.P, 100);
ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
pingSerial();

ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
y += MENU_START_ROW*2;
x = 10;
ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
pingSerial();
ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
pingSerial();
x += (16*4) + 8;
ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,8,y+25,"ROOM:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], T2TempColor,
9, y+35, 10);
ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x+8,y+25,"SUMP:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], T3TempColor,
x+9, y+35, 10);


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

}

void DrawCustomGraph()
{
}


void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

ReefAngel.FeedingModePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 850 );

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

void loop()
{
// Specific functions
// ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights( Port1,8,0,20,0 );
ReefAngel.StandardLights( Port2,10,0,18,0 );
ReefAngel.StandardHeater( Port7,765,780 );
ReefAngel.StandardFan( Port8,771,781 );


ReefAngel.ShowInterface();

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Nov 23, 2016 8:00 pm
Do you have the wifi attachment?
It's super easy to turn lights on with the smartphone app.
Roberto.

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Wed Nov 23, 2016 8:44 pm
No, I don't have Wifi attachment.

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Nov 24, 2016 1:23 am
You can only use 9 max menu items.
If you take version, you can turn on, but you will never be able to turn off.
Is there anything you want to remove?
What port do you have the sump light connected to?
Roberto.

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Thu Nov 24, 2016 5:13 am
Hi, we could remove Date / Time and the Version and if possible for the sump light will be the opposite of the port1 when it Off.
Thanks!

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Fri Nov 25, 2016 8:41 am
Any one could help me please?
Thank you!

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Nov 25, 2016 9:47 am
Try this:
Code: Select all
/* The following features are enabled for this File:
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 9
#define PWMEXPANSION
#define CUSTOM_MAIN
#define COLORS_PDE
#define FONT_8x16
*/


#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.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 <ReefAngel.h>

#define Light Actinic 1
#define Light Full sp 2
#define Jebao 3
#define Jecod 4
#define Skimmer 5
#define Return 6
#define Heater 7
#define Fan 8

#include <avr/pgmspace.h>
prog_char menu1_label[] PROGMEM = "Feeding";
prog_char menu2_label[] PROGMEM = "Water Change";
prog_char menu3_label[] PROGMEM = "ATO Clear";
prog_char menu4_label[] PROGMEM = "Overheat Clear";
prog_char menu5_label[] PROGMEM = "PH Calibration";
prog_char menu6_label[] PROGMEM = "Lights On";
prog_char menu7_label[] PROGMEM = "Lights Off";
prog_char menu8_label[] PROGMEM = "Turn ON Skimmer";
prog_char menu9_label[] PROGMEM = "Turn Off Skimmer";
// Group the menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label,
menu4_label, menu5_label, menu6_label,
menu7_label, menu8_label, menu9_label
};

void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry5()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry6()
{
ReefAngel.LightsOn();
}
void MenuEntry7()
{
ReefAngel.LightsOff();
}
void MenuEntry8()
{
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry9()
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

//custom dysplay temp+on and off relay
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 6, 2, "Marco's ReefAngel");
ReefAngel.LCD.DrawDate(6, 118);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 17, 132, 17);
pingSerial();
x = 12;
y += MENU_START_ROW+1;
ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Display PH");
char text[7];
ConvertNumToString(text, ReefAngel.Params.P, 100);
ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
pingSerial();

ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
y += MENU_START_ROW*2;
x = 10;
ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
pingSerial();
ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
pingSerial();
x += (16*4) + 8;
ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,8,y+25,"ROOM:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], T2TempColor,
9, y+35, 10);
ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x+8,y+25,"SUMP:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], T3TempColor,
x+9, y+35, 10);


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

}

void DrawCustomGraph()
{
}


void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

ReefAngel.FeedingModePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 850 );

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

void loop()
{
// Specific functions
// ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights( Port1,8,0,20,0 );
ReefAngel.StandardLights( Port2,10,0,18,0 );
ReefAngel.StandardHeater( Port7,765,780 );
ReefAngel.StandardFan( Port8,771,781 );


ReefAngel.ShowInterface();
Roberto.

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Fri Nov 25, 2016 10:05 am
Thank you very much Roberto! I will try it when I get home and I will let you know the result.

Posts: 10
Joined: Wed Nov 16, 2016 4:36 am
PostPosted: Fri Nov 25, 2016 2:17 pm
Hi Roberto, Ya the menu are there now but Lights On and Lights Off still didn't work and it's only white blank screen and the relay didn't even make any sounds. I think I already tried edited that line before but it didn't work as well.

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Nov 25, 2016 5:06 pm
Did you change this line too:
Code: Select all
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
Roberto.
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 3 guests