Custom menu item

Do you have a question on how to do something.
Ask in here.
Post Reply
dmglakewood
Posts: 26
Joined: Thu Mar 01, 2012 1:31 pm

Custom menu item

Post by dmglakewood »

I'm looking to create a custom menu item like the feeding mode where it will run a certain function over and over again until the timer is at 0 then it will go back to normal. Can someone point me in the right direction for this or provide me with some sample code?

Thanks
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom menu item

Post by binder »

Start here. http://forum.reefangel.com/viewtopic.php?f=14&t=311
Read the guide. It explains a lot and should get you started in the right direction. You may also want to look in the examples that get installed with the Arduino Reef Angel Installer. They are located at File -> Sketchbook -> Examples.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom menu item

Post by rimai »

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

prog_char menu1_label[] PROGMEM = "My Custom Function";
PROGMEM const char *menu_items[] = {
  menu1_label};

void MenuEntry1()
{
  ReefAngel.Timer[1].Start();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

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

void loop()
{
  if (!ReefAngel.Timer[1].IsTriggered() && ReefAngel.Timer[1].Trigger!=0) MyCustomFunction();
  ReefAngel.ShowInterface();
}

void MyCustomFunction()
{
  // Do Something
}
Roberto.
Post Reply