am i doing some thing wrong that i dont get any help

i am new to this please help me digital programmable 7 day weekly timer need to mod menu & alarm i want to be able to set in the menu alarm on and off time it needs to run like this ( monday thru thursday turn on 4:30 pm turn off 2 am) (now friday turn on 4:30pm stay on all weekend turn off monday 2 am
i am using this code i found with 4 X 20 lcd i have it

the relay is on pin 12 it goes high to turn on
i have it working just need to mod the alarm

Phi clock version 5
there are parts to this code in the files down below i dont no how to post it all at one time here in text form

this is were i got the code i have it working with a arduino uno and rtc

i think i have to edit here

void top_menu_function_3() //Set alarms
{
int temp1, ala=0;
char msg[17];
int user_input;
phi_prompt_struct myIntegerInput, myListInput; // This structure stores the main menu.
lcd.clear();
sprintf(msg,“Alarm %02d:”,0);
lcd.print(msg);

user_input=0; // Current value
myIntegerInput.ptr.i_buffer=&user_input; // Pass the address of the buffer
myIntegerInput.low.i=0; // Lower limit
myIntegerInput.high.i=Max_alarms-1; // Upper limit
myIntegerInput.step.i=1; // Step size
myIntegerInput.col=7; // Display prompt at column 7
myIntegerInput.row=1; // Display prompt at row 1
myIntegerInput.width=2; // The number occupies 2 characters space
myIntegerInput.option=1; // Option 0, space pad right, option 1, zero pad left, option 2, space pad left.
lcd.clear();
center_text(“Which alarm?”); // Prompt user for input
if (input_integer(&myIntegerInput)!=-1) ala=user_input; // If the user didn’t press escape (return -1) then update the ultimate storage with the value in the buffer.
else return;

user_input=clock1.alarms[ala].hr; // Current value
myIntegerInput.high.i=23; // Upper limit
lcd.clear();
center_text(“Hour”); // Prompt user for input
if (input_integer(&myIntegerInput)!=-1) clock1.alarms[ala].hr=user_input; // If the user didn’t press escape (return -1) then update the ultimate storage with the value in the buffer.
else return;

user_input=clock1.alarms[ala].mnt; // Current value
myIntegerInput.high.i=59; // Upper limit
lcd.clear();
center_text(“Minute”); // Prompt user for input
if (input_integer(&myIntegerInput)!=-1) clock1.alarms[ala].mnt=user_input; // If the user didn’t press escape (return -1) then update the ultimate storage with the value in the buffer.
else return;

myListInput.ptr.list=(char**)&alarm_items; // Assign the list to the pointer
myListInput.low.i=clock1.alarms[ala].dow; // Default item highlighted on the list
myListInput.high.i=4; // Last item of the list is size of the list - 1.
myListInput.width=7; // Length in characters of the longest list item.
myListInput.col=0; // Display prompt at column 0
myListInput.row=1; // Display prompt at row 1
myListInput.option=1; // Option 0, display classic list, option 1, display 2X2 list, option 2, display list with index, option 3, display list with index2.
myListInput.step.c_arr[0]=lcd_rows-1; // rows to auto fit entire screen
myListInput.step.c_arr[1]=lcd_columns/8; // multi col list
lcd.clear();
center_text(“Type”); // Prompt user for input
if (select_list(&myListInput)!=-1) clock1.alarms[ala].dow=myListInput.low.i; // select_list stores user choice in myListInput.low. If the user didn’t press escape (return -1) then update the user choice with the value in myListInput.low.
else return;

clock1.save_alarm(ala); ///< Save the setting of this particular alarm to EEPROM.
}

or here

void alarm_clock::alarm()
{
int temp1;
for (int i=0;i<4;i++)
{
tone(buzzer,770);
temp1=wait_on_escape(75);
if ((temp1==5)||(temp1==6))
{
noTone(buzzer);
alarm_is_on=false; // Turn off alarm
return;
}
noTone(buzzer);
temp1=wait_on_escape(75);
if ((temp1==5)||(temp1==6))
{
noTone(buzzer);
alarm_is_on=false; // Turn off alarm
return;
}
}
temp1=wait_on_escape(150);
if ((temp1==5)||(temp1==6))
{
noTone(buzzer);
alarm_is_on=false; // Turn off alarm
return;
}
}

Phi_2_project_alarm_clock_v6.ino (9.2 KB)

Example_menu.ino (12.2 KB)

alarm_clock.ino (5.04 KB)

You might have to wait a while for a response ( some people are asleep right now! ), liudr may even see your previous thread at some stage.

How do you set alarms now?
Can you set more than one?
Can you just add more alarms for the off time?

Do you have a link to the original project you are using?

thank you for the reply here is the project is here

and yes it has 4 alarms

You would get more help if you could actually be bothered to post your code correctly. Read the how to use this forum sticky post.

ok i will thanks

i did but i dont get how to do it can you walk me thru it please thanks

The thing is that if you can't read that sticky post and understand it how do you think you are going to understand any answer you get?
That sort of thing puts off people who could help you because they recon they will be wasteing their time.
You enclose your code in tags which you get when you hit the # icon in the reply box.

/*
Phi-2 shield for Arduino
Program title: Phi clock version 5 
----------------------------------------
Programmed by Dr. John Liu
Revision: 02/28/2012
Free software for educational and personal uses.
No warrantee!
Commercial use without authorization is prohibited.
Find details of the Phi-1 shield, Phi-2 shield, and Phi-prompt or contact Dr. Liu at
http://liudr.wordpress.com/phi-1-shield/
http://liudr.wordpress.com/phi-2-shield/
http://liudr.wordpress.com/phi_interfaces/
http://liudr.wordpress.com/phi_prompt/
All rights reserved.
*/
#include "alarm_clock.h"
#include <EEPROM.h>

void render_RTC(int temp)
{
  int rtc[7];
  char msg[17];
  int user_input;
  phi_prompt_struct myListInput; // This structure stores the main menu.

  RTC.get(rtc,true);

  switch(temp)
  {
    case 0:
    myListInput.ptr.list=(char**)&month_items; // Assign the list to the pointer
    myListInput.low.i=rtc[5]-1; // Default item highlighted on the list
    myListInput.high.i=11; // Last item of the list is size of the list - 1.
    myListInput.width=3; // Length in characters of the longest list item.
    myListInput.col=lcd_columns/2-8; // Display prompt at column 0
    myListInput.row=lcd_rows/2-1; // Display prompt at row 1
    myListInput.option=0; 
    myListInput.step.c_arr[0]=1; // rows to auto fit entire screen
    myListInput.step.c_arr[1]=1; // one col list
    render_list(&myListInput);
    sprintf(msg,"/%02d/%4d/",rtc[4],rtc[6]);
    lcd.print(msg);
    
    myListInput.ptr.list=(char**)&dow_items; // Assign the list to the pointer
    myListInput.low.i=rtc[3]-1; // Default item highlighted on the list
    myListInput.high.i=6; // Last item of the list is size of the list - 1.
    myListInput.col=lcd_columns/2-8+12; // Display prompt at column 0
    render_list(&myListInput);

    lcd.setCursor(lcd_columns/2-4,lcd_rows/2);
    sprintf(msg,"%2d:%02d:%02d",rtc[2],rtc[1],rtc[0]);
    lcd.print(msg);
    break;
    
    case 1:
    sprintf(msg,"%02d%02d",rtc[2],rtc[1]);
    render_big_msg(msg,lcd_columns/2-8,0);
    if ((lcd_rows==4)&&(lcd_columns==20))
    {
      strcpy_P(msg,(char*)pgm_read_word(dow_items+rtc[3]-1));
      sprintf(msg+3,"%02d",rtc[4]);
      render_big_msg(msg,0,2);
    }
    if (rtc[0]%2)
    {
      lcd.setCursor(lcd_columns/2-1,0);
      lcd.write('.');
      lcd.setCursor(lcd_columns/2-1,1);
      lcd.write('.');
    }
    else
    {
      lcd.setCursor(lcd_columns/2-1,0);
      lcd.write(' ');
      lcd.setCursor(lcd_columns/2-1,1);
      lcd.write(' ');
    }
    break;
    default:
    break;
  }
}

alarm_clock::alarm_clock(boolean noo) // This parameter is needed otherwise the compiler won't work with a constructor without parameters.
{
  alarm_is_on=false;
  snooze=10;
}

byte alarm_clock::run()
{
  int rtc[7];
  render_RTC(clock_style);
  RTC.get(rtc,true);
  for (int i=0;i<4;i++)
  {
    if ((alarms[i].hr==rtc[2])&&(alarms[i].mnt==rtc[1])&&(rtc[0]==0)&&within(i,rtc[3]))
    {
      alarm_is_on=true;
    }
  }
  if (alarm_is_on) alarm();
}

byte alarm_clock::set_alarm(byte alarm_num, byte hr, byte mnt, byte dow)
{
  if (alarm_num>=Max_alarms) return 255;
  if (hr>23) return 255;
  if (mnt>59) return 255;
  alarms[alarm_num].hr=hr;
  alarms[alarm_num].mnt=mnt;
  alarms[alarm_num].dow=dow;
  return 0;
}

void alarm_clock::alarm()
{
  int temp1;
  for (int i=0;i<4;i++)
  {
    tone(buzzer,770);
    temp1=wait_on_escape(75);
    if ((temp1==5)||(temp1==6))
    {
      noTone(buzzer);
      alarm_is_on=false; // Turn off alarm
      return;
    }
    noTone(buzzer);
    temp1=wait_on_escape(75);
    if ((temp1==5)||(temp1==6))
    {
      noTone(buzzer);
      alarm_is_on=false; // Turn off alarm
      return;
    }
  }
  temp1=wait_on_escape(150);
  if ((temp1==5)||(temp1==6))
  {
    noTone(buzzer);
    alarm_is_on=false; // Turn off alarm
    return;
  }
}

boolean alarm_clock::within(byte ala, byte dow) // This function checks if the day of the week is within alarm clock's trigger setting.
{
  switch(alarms[ala].dow)
  {
    case 0: // Alarm is off
    return false;
    break;
    
    case 1: // Alarm is on daily
    return true;
    break;
    
    case 2: // Alarm is on M-F
    if ((dow>1)&&(dow<7)) return true;
    else return false;
    break;
    
    case 3: // Alarm is on Weekend
    if ((dow==1)||(dow==7)) return true;
    else return false;
    
    case 4: // Alarm is on once so set it to off and return true
    alarms[ala].dow=0;
    save_alarm(ala); //Save the status of this once clock to EEPROM so it stays off after on triggering.
    return true;
    break;
    
    default:
    return false;
    break;
  }
}

void alarm_clock::turn_on(byte alarm_num) // This function is not used.
{
  if (alarm_num<Max_alarms) alarms[alarm_num].on_off=true;
} 

void alarm_clock::turn_off(byte alarm_num) // This function is not used.
{
  if (alarm_num<Max_alarms) alarms[alarm_num].on_off=false;
} 

void alarm_clock::save_alarm(byte ala) // This function saves the alarm setting of the alarm ala to the ATMEGA328 EEPROM.
{
  EEPROM.write(alarm_EEPROM_storage+3*ala,alarms[ala].hr); // Alarm hour
  delay(100);

  EEPROM.write(alarm_EEPROM_storage+3*ala+1,alarms[ala].mnt); // Alarm minute
  delay(100);

  EEPROM.write(alarm_EEPROM_storage+3*ala+2,alarms[ala].dow); // Alarm frequency M-F
  delay(100);
}
// Menu texts
PROGMEM prog_char top_menu_item00[]="Display clock";
PROGMEM prog_char top_menu_item01[]="Adjust time";
PROGMEM prog_char top_menu_item02[]="Set alarms";
PROGMEM prog_char top_menu_item03[]="Display settings";
PROGMEM prog_char top_menu_item04[]="Show credit";
PROGMEM const char *top_menu_items[] = {top_menu_item00, top_menu_item01, top_menu_item02, top_menu_item03, top_menu_item04};

//This program is the main menu. It handles inputs from the keys, updates the menu or executes a certain menu function accordingly.
int clock_style=0; // This is the style of the menu
void top_menu()
{
  int menu_pointer_1=0; // This stores the menu choice the user made.
  phi_prompt_struct myMenu; // This structure stores the main menu.

// Initialize the top menu
  myMenu.ptr.list=(char**)&top_menu_items; // Assign the list to the pointer
  myMenu.low.i=0; // Default item highlighted on the list
  myMenu.high.i=4; // Last item of the list is size of the list - 1.
  myMenu.width=lcd_columns-1; // Length in characters of the longest list item.
  myMenu.step.c_arr[0]=lcd_rows-1; // rows to auto fit entire screen
  myMenu.step.c_arr[1]=1; // one col list
  myMenu.step.c_arr[2]=0; // y for additional feature such as an index
  myMenu.step.c_arr[3]=lcd_columns-4; // x for additional feature such as an index
  myMenu.col=0; // Display prompt at column 0
  myMenu.row=1; // Display prompt at row 1
  myMenu.option=45;
  
  while(1) // This loops every time a menu item is selected.
  {
    lcd.clear();  // Refresh menu if a button has been pushed
    lcd.print("Main Menu");

    select_list(&myMenu); // Use the select_list to ask the user to select an item of the list, that is a menu item from your menu.
    menu_pointer_1=myMenu.low.i; // Get the selected item number and store it in the menu pointer.
    switch (menu_pointer_1) // See which menu item is selected and execute that correspond function
    {
      case 0:
      lcd.clear();
      top_menu_function_1();
      break;
      case 1:
      lcd.clear();
      top_menu_function_2();
      break;
      case 2:
      lcd.clear();
      top_menu_function_3();
      break;
      
      case 3:
      lcd.clear();
      top_menu_function_4();
      break;
      
      case 4:
      lcd.clear();
      top_menu_function_5();
      break;
      
      default:
      break;
    }

  }
}

// Menu functions go here. The functions are called when their menu items are selected. They are called only once so if you want to do something repeatedly, make sure you have a while loop.
void top_menu_function_1() //This runs the clock
{
  lcd.clear();
  center_text("Anykey to return");
  wait_on_escape(1000);
  lcd.clear();
  int temp1;
  while (1)
  {
    clock1.run();
    if (!clock1.alarm_is_on)
    {
      temp1=wait_on_escape(1000);
      switch (temp1)
      {
        case 0:
        break;
        
        default:
        return;
        break;
      }
    }
  }  
}

void top_menu_function_2() //Set the clock
{
  int user_input;
  phi_prompt_struct myIntegerInput, myListInput; // This structure stores the main menu.

  render_RTC(0);
  RTC.get(rtc,true);

  user_input=rtc[2]; // Current value
  myIntegerInput.ptr.i_buffer=&user_input; // Pass the address of the buffer
  myIntegerInput.low.i=0; // Lower limit
  myIntegerInput.high.i=23; // Upper limit
  myIntegerInput.step.i=1; // Step size
  myIntegerInput.col=7; // Display prompt at column 7
  myIntegerInput.row=1; // Display prompt at row 1
  myIntegerInput.width=2; // The number occupies 2 characters space
  myIntegerInput.option=1; // Option 0, space pad right, option 1, zero pad left, option 2, space pad left.
  lcd.clear();
  center_text("Hour"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) rtc[2]=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;

  user_input=rtc[1]; // Current value
  myIntegerInput.low.i=0; // Lower limit
  myIntegerInput.high.i=59; // Upper limit
  lcd.clear();
  center_text("Minute"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) rtc[1]=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;
  
  user_input=rtc[0]; // Current value
  lcd.clear();
  center_text("Second"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) rtc[0]=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;
  
  user_input=rtc[6]; // Current value
  myIntegerInput.ptr.i_buffer=&user_input; // Pass the address of the buffer
  myIntegerInput.low.i=2000; // Lower limit
  myIntegerInput.high.i=2099; // Upper limit
  myIntegerInput.step.i=1; // Step size
  myIntegerInput.col=6; // Display prompt at column 7
  myIntegerInput.row=1; // Display prompt at row 1
  myIntegerInput.width=4; // The number occupies 2 characters space
  myIntegerInput.option=0; // Option 0, space pad right, option 1, zero pad left, option 2, space pad left.
  lcd.clear();
  center_text("Year"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) rtc[6]=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;

  myListInput.ptr.list=(char**)&month_items; // Assign the list to the pointer
  myListInput.low.i=rtc[5]-1; // Default item highlighted on the list
  myListInput.high.i=11; // Last item of the list is size of the list - 1.
  myListInput.width=3; // Length in characters of the longest list item.
  myListInput.col=0; // Display prompt at column 0
  myListInput.row=1; // Display prompt at row 1
  myListInput.option=1; 
  myListInput.step.c_arr[0]=lcd_rows-1; // rows to auto fit entire screen
  myListInput.step.c_arr[1]=lcd_columns/4; // multi col list
  lcd.clear();
  center_text("Month"); // Prompt user for input
  if (select_list(&myListInput)!=-1) rtc[5]=myListInput.low.i+1; // select_list stores user choice in myListInput.low. If the user didn't press escape (return -1) then update the user choice with the value in myListInput.low.
  else return;
  
  user_input=rtc[4]; // Current value
  myIntegerInput.low.i=1; // Lower limit
  myIntegerInput.high.i=31; // Upper limit
  lcd.clear();
  center_text("Date"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) rtc[4]=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;
  myListInput.ptr.list=(char**)&dow_items; // Assign the list to the pointer
  myListInput.low.i=rtc[3]-1; // Default item highlighted on the list
  myListInput.high.i=6; // Last item of the list is size of the list - 1.
  myListInput.width=3; // Length in characters of the longest list item.
  myListInput.col=0; // Display prompt at column 0
  myListInput.row=1; // Display prompt at row 1
  myListInput.option=1; 
  myListInput.step.c_arr[0]=lcd_rows-1; // rows to auto fit entire screen
  myListInput.step.c_arr[1]=lcd_columns/4; // multi col list
  lcd.clear();
  center_text("Day of the week"); // Prompt user for input
  if (select_list(&myListInput)!=-1) rtc[3]=myListInput.low.i+1; // select_list stores user choice in myListInput.low. If the user didn't press escape (return -1) then update the user choice with the value in myListInput.low.
  else return;

  RTC.stop();
  RTC.set(DS1307_SEC,rtc[0]); //rtc[0]
  RTC.set(DS1307_MIN,rtc[1]); //rtc[1]
  RTC.set(DS1307_HR,rtc[2]);  //rtc[2]
  RTC.set(DS1307_DOW,rtc[3]); //rtc[3] value from 1 to 7. User define whether 1 is sun or mon.
  RTC.set(DS1307_DATE,rtc[4]);//rtc[4]
  RTC.set(DS1307_MTH,rtc[5]); //rtc[5] Month
  RTC.set(DS1307_YR,rtc[6]-2000);  //rtc[6] Year only has years since 2000 so 10 represents 20100.
  RTC.start();
}

void top_menu_function_3() //Set alarms
{
  int temp1, ala=0;
  char msg[17];
  int user_input;
  phi_prompt_struct myIntegerInput, myListInput; // This structure stores the main menu.
  lcd.clear();
  sprintf(msg,"Alarm %02d:",0);
  lcd.print(msg);

  user_input=0; // Current value
  myIntegerInput.ptr.i_buffer=&user_input; // Pass the address of the buffer
  myIntegerInput.low.i=0; // Lower limit
  myIntegerInput.high.i=Max_alarms-1; // Upper limit
  myIntegerInput.step.i=1; // Step size
  myIntegerInput.col=7; // Display prompt at column 7
  myIntegerInput.row=1; // Display prompt at row 1
  myIntegerInput.width=2; // The number occupies 2 characters space
  myIntegerInput.option=1; // Option 0, space pad right, option 1, zero pad left, option 2, space pad left.
  lcd.clear();
  center_text("Which alarm?"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) ala=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;

  user_input=clock1.alarms[ala].hr; // Current value
  myIntegerInput.high.i=23; // Upper limit
  lcd.clear();
  center_text("Hour"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) clock1.alarms[ala].hr=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;

  user_input=clock1.alarms[ala].mnt; // Current value
  myIntegerInput.high.i=59; // Upper limit
  lcd.clear();
  center_text("Minute"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) clock1.alarms[ala].mnt=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;

  myListInput.ptr.list=(char**)&alarm_items; // Assign the list to the pointer
  myListInput.low.i=clock1.alarms[ala].dow; // Default item highlighted on the list
  myListInput.high.i=4; // Last item of the list is size of the list - 1.
  myListInput.width=7; // Length in characters of the longest list item.
  myListInput.col=0; // Display prompt at column 0
  myListInput.row=1; // Display prompt at row 1
  myListInput.option=1; // Option 0, display classic list, option 1, display 2X2 list, option 2, display list with index, option 3, display list with index2.
  myListInput.step.c_arr[0]=lcd_rows-1; // rows to auto fit entire screen
  myListInput.step.c_arr[1]=lcd_columns/8; // multi col list
  lcd.clear();
  center_text("Type"); // Prompt user for input
  if (select_list(&myListInput)!=-1) clock1.alarms[ala].dow=myListInput.low.i; // select_list stores user choice in myListInput.low. If the user didn't press escape (return -1) then update the user choice with the value in myListInput.low.
  else return;

  clock1.save_alarm(ala); ///< Save the setting of this particular alarm to EEPROM.
}

void top_menu_function_4() //
{
  int user_input;
  phi_prompt_struct myIntegerInput; // This structure stores the main menu.

  user_input=clock_style; // Current value
  myIntegerInput.ptr.i_buffer=&user_input; // Pass the address of the buffer
  myIntegerInput.low.i=0; // Lower limit
  myIntegerInput.high.i=1; // Upper limit
  myIntegerInput.step.i=1; // Step size
  myIntegerInput.col=7; // Display prompt at column 7
  myIntegerInput.row=1; // Display prompt at row 1
  myIntegerInput.width=1; // The number occupies 2 characters space
  myIntegerInput.option=0; // Option 0, space pad right, option 1, zero pad left, option 2, space pad left.
  lcd.clear();
  center_text("Clock style"); // Prompt user for input
  if (input_integer(&myIntegerInput)!=-1) clock_style=user_input; // If the user didn't press escape (return -1) then update the ultimate storage with the value in the buffer.
  else return;
}

void top_menu_function_5() //Show credit
{
  show_credit();
}
/*
Phi-2 shield for Arduino
Program title: Phi clock version 5 
----------------------------------------
Instructions:
0. Please download phi_interfaces library (http://liudr.wordpress.com/phi_interfaces/) and unzip the files and example subfolders in arduino\sketchbooks\libraries\phi_interfaces\
1. Please download phi_prompt library (http://liudr.wordpress.com/phi_prompt/) and unzip the files and example subfolders in arduino\sketchbooks\libraries\phi_prompt\
2. Please download phi_big_font library (http://liudr.wordpress.com/phi_big_font/) and unzip the three files and example subfolders in arduino\sketchbooks\libraries\phi_big_font\
3. Please set the size of you display with "#define lcd_rows" and "#define lcd_columns" so the program will automatically adjust to your display size.
4. You need to set the clock before you can use it. Uncomment this line "#define setRTC" among the #define lines.
5. Update the time in setup() to the current time.
6. Upload the sketch to arduino to set the time.
7. Then comment the line "#define setRTC" and recompile and upload to arduino.
8. If you don't do step 4, the clock will be reset every time arduino resets.
----------------------------------------
Programmed by Dr. John Liu
Revision: 08/26/2012
Free software for educational and personal uses.
No warrantee!
Commercial use without authorization is prohibited.
Find details of the Phi-1 shield, Phi-2 shield, and Phi-prompt or contact Dr. Liu at
http://liudr.wordpress.com/phi-1-shield/
http://liudr.wordpress.com/phi-2-shield/
http://liudr.wordpress.com/phi_interfaces/
http://liudr.wordpress.com/phi_prompt/
All rights reserved.
----------------------------------------
List of functions:
* Display real time clock with Year month, date, day of week, hour, minute, and second.
* Four individual alarms (change Max_alarms to get more alarms)
* Alarms are stored on Arduino EEPROM and won't be lost when the power is out.
* Alarms Daily, Weekday, Weekend, Once, Off.
* Adjustable alarms. Press B to choose alarm and adjust the time.
* Adjustable clock and date. Press A to adjust clock and date.
* TODO - Add snooze function.
* TODO - Add special function on the alarm to drive outputs other than the buzzer and LED. You can be creative!
----------------------------------------
Thanks:

RTC created by matt.joyce@gmail.com

EEPROM Author: hkhijhe

Dependent libraries:
Phi_prompt version 1.0
Phi_interfaces version 1.0
Phi_big_font version 1.0

Updates:
 * 8/26/2012: I corrected the bug Andrew found about the "ONCE" alarm not turned off in EEPROM settings.
 * I rewrote the code to save the status of a "ONCE" alarm to EEPROM as "OFF" once it is triggered. This was made possible with the addition of method save_alarm().
 * Now the set alarm function in the Example_menu also calls this save_alarm method.
*/
#define phi_2_shield
#include <LiquidCrystal.h>
#include <Wire.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>
#include <phi_big_font.h>
#include "DS1307_1.h" 
#include "alarm_clock.h"

#define lcd_rows 4
#define lcd_columns 20
//#define setRTC
//Phi-2 shield definitions

//Phi-2 shield buttons and channel pin assignments
#define buzzer A2
#define total_buttons 6
#define btn_u 5
#define btn_d 10
#define btn_l 11
#define btn_r 4
#define btn_b A0
#define btn_a A1

//Phi-2 shield LCD pin setting
#define LCD_RS 8
#define LCD_EN 9
#define LCD_D4 7
#define LCD_D5 6
#define LCD_D6 2
#define LCD_D7 3

PROGMEM prog_char msg_00[]="LCD ALARM CLOCK\nBy Dr. Liu\n08/26/12 Ver 6\nhttp://liudr.wordpress.com";

PROGMEM prog_char month_00[]="JAN";
PROGMEM prog_char month_01[]="FEB";
PROGMEM prog_char month_02[]="MAR";
PROGMEM prog_char month_03[]="APR";
PROGMEM prog_char month_04[]="MAY";
PROGMEM prog_char month_05[]="JUN";
PROGMEM prog_char month_06[]="JUL";
PROGMEM prog_char month_07[]="AUG";
PROGMEM prog_char month_08[]="SEP";
PROGMEM prog_char month_09[]="OCT";
PROGMEM prog_char month_10[]="NOV";
PROGMEM prog_char month_11[]="DEC";
PROGMEM const char *month_items[]= {month_00,month_01,month_02,month_03,month_04,month_05,month_06,month_07,month_08,month_09,month_10,month_11};

PROGMEM prog_char dow_00[]="SUN";
PROGMEM prog_char dow_01[]="MON";
PROGMEM prog_char dow_02[]="TUE";
PROGMEM prog_char dow_03[]="WED";
PROGMEM prog_char dow_04[]="THU";
PROGMEM prog_char dow_05[]="FRI";
PROGMEM prog_char dow_06[]="SAT";
PROGMEM const char *dow_items[]= {dow_00,dow_01,dow_02,dow_03,dow_04,dow_05,dow_06};

PROGMEM prog_char alarm_00[]="Off";
PROGMEM prog_char alarm_01[]="Daily";
PROGMEM prog_char alarm_02[]="Weekday";
PROGMEM prog_char alarm_03[]="Weekend";
PROGMEM prog_char alarm_04[]="Once";
PROGMEM const char *alarm_items[]= {alarm_00,alarm_01,alarm_02,alarm_03,alarm_04};

PROGMEM prog_char lcd_chr0[]={64,64,64,64,64,64,64,64,0};// 0
PROGMEM prog_char lcd_chr1[]={64,64,64,64,64,31,31,31,0};//1
PROGMEM prog_char lcd_chr2[]={64,64,64,31,31,64,64,64,0};//2
PROGMEM prog_char lcd_chr3[]={64,64,64,31,31,31,31,31,0};//3 {64,64,64,31,31,64,31,31,0};
PROGMEM prog_char lcd_chr4[]={31,31,31,64,64,64,64,64,0};//4
PROGMEM prog_char lcd_chr5[]={31,31,64,64,64,31,31,31,0};//5
PROGMEM prog_char lcd_chr6[]={31,31,31,31,31,64,64,64,0};//6 {31,31,64,31,31,64,64,64,0}
PROGMEM prog_char lcd_chr7[]={31,31,31,31,31,31,31,31,0};//7 {31,31,64,31,31,64,31,31,0}
PROGMEM const char *chr_item[] = {lcd_chr0, lcd_chr1, lcd_chr2, lcd_chr3, lcd_chr4, lcd_chr5, lcd_chr6, lcd_chr7};// The following lines instantiates a button group to control 6 buttons

byte pins[]={btn_u,btn_d,btn_l,btn_r,btn_b,btn_a}; // The digital pins connected to the 6 buttons.
char mapping[]={'U','D','L','R','B','A'}; // This is a list of names for each button.
phi_button_groups my_btns(mapping, pins, total_buttons);

// This serial keypad is for debugging.
phi_serial_keypads debug_keypad(&Serial,115200); 

// The following sets up function keys for phi_prompt library
char up_keys[]={"U"}; ///< All keys that act as the up key are listed here.
char down_keys[]={"D"}; ///< All keys that act as the down key are listed here.
char left_keys[]={"L"}; ///< All keys that act as the left key are listed here.
char right_keys[]={"R"}; ///< All keys that act as the right key are listed here.
char enter_keys[]={"B"}; ///< All keys that act as the enter key are listed here.
char escape_keys[]={"A"}; ///< All keys that act as the escape key are listed here.
char * function_keys[]={up_keys,down_keys,left_keys,right_keys,enter_keys,escape_keys}; ///< All function key names are gathered here fhr phi_prompt.

// The following adds all available keypads as inputs for phi_prompt library
multiple_button_input * keypads[]={&my_btns,&debug_keypad,0};

LiquidCrystal lcd(LCD_RS,LCD_EN,LCD_D4,LCD_D5,LCD_D6,LCD_D7); // Create the lcd object

int rtc[7];
DS1307 RTC=DS1307(); // Create RTC object
alarm_clock clock1(false); // Create an alarm clock
void setup()
{
  byte ch_buffer[10]; // This buffer is required for custom characters on the LCD.
  lcd.begin(lcd_columns, lcd_rows);
  Wire.begin(); // initialize wire
  init_phi_prompt(&lcd,keypads,function_keys, lcd_columns, lcd_rows, '~'); // Supply the liquid crystal object, input keypads, and function key names. Also supply the column and row of the lcd, and indicator as '>'. You can also use '\x7e', which is a right arrow.
  init_big_font(&lcd);

// Set the two channels to output to drive the buzzer and LED.
  pinMode(buzzer,OUTPUT);
  digitalWrite(buzzer,LOW);

#ifdef setRTC
// Set/init RTC
  RTC.stop();
  RTC.set(DS1307_SEC,0);
  RTC.set(DS1307_MIN,50);
  RTC.set(DS1307_HR,0);
  RTC.set(DS1307_DOW,3); // value from 1 to 7. User define whether 1 is sun or mon.
  RTC.set(DS1307_DATE,16);
  RTC.set(DS1307_MTH,11);
  RTC.set(DS1307_YR,10);
  RTC.start();

//Set alarms
  EEPROM.write(alarm_EEPROM_storage,6); // Alarm 0 hour
  EEPROM.write(alarm_EEPROM_storage+1,50); // Alarm 0 minute
  EEPROM.write(alarm_EEPROM_storage+2,2); // Alarm 0 frequency M-F

  EEPROM.write(alarm_EEPROM_storage+3,7); // Alarm 1 hour
  EEPROM.write(alarm_EEPROM_storage+4,00); // Alarm 1 minute
  EEPROM.write(alarm_EEPROM_storage+5,2); // Alarm 1 frequency M-F

  EEPROM.write(alarm_EEPROM_storage+6,7); // Alarm 2 hour
  EEPROM.write(alarm_EEPROM_storage+7,10); // Alarm 2 minute
  EEPROM.write(alarm_EEPROM_storage+8,2); // Alarm 2 frequency M-F

  EEPROM.write(alarm_EEPROM_storage+9,9); // Alarm 3 hour
  EEPROM.write(alarm_EEPROM_storage+10,30); // Alarm 3 minute
  EEPROM.write(alarm_EEPROM_storage+11,3); // Alarm 3 frequency Weekend
#else
// Set alarm on the clock from EEPROM.
  clock1.set_alarm(0, EEPROM.read(alarm_EEPROM_storage), EEPROM.read(alarm_EEPROM_storage+1), EEPROM.read(alarm_EEPROM_storage+2));
  clock1.set_alarm(1, EEPROM.read(alarm_EEPROM_storage+3), EEPROM.read(alarm_EEPROM_storage+4), EEPROM.read(alarm_EEPROM_storage+5));
  clock1.set_alarm(2, EEPROM.read(alarm_EEPROM_storage+6), EEPROM.read(alarm_EEPROM_storage+7), EEPROM.read(alarm_EEPROM_storage+8));
  clock1.set_alarm(3, EEPROM.read(alarm_EEPROM_storage+9), EEPROM.read(alarm_EEPROM_storage+10), EEPROM.read(alarm_EEPROM_storage+11));
#endif

  show_credit();
}

void loop()
{
  top_menu(); // See Example_menu.pde
}

void show_credit()
{
  // Display credits
  phi_prompt_struct myLongMsg;

  lcd.clear();
  lcd.noBlink();
  myLongMsg.ptr.msg_P=msg_00; // Assign the address of the text string to the pointer.
  myLongMsg.low.i=0; // Default text starting position. 0 is highly recommended.
  myLongMsg.high.i=strlen_P(msg_00); // Position of the last character in the text string, which is size of the string - 1.
  myLongMsg.step.c_arr[0]=lcd_rows; // rows to auto fit entire screen
  myLongMsg.step.c_arr[1]=lcd_columns; // one col list
  myLongMsg.col=0; // Display the text area starting at column 0
  myLongMsg.row=0; // Display the text area starting at row 0
  myLongMsg.option=0; // Option 0, display classic message, option 1, display message with scroll bar on right.

  text_area_P(&myLongMsg);
}

The other reason you might not be getting answers is that you've now asked the same question about four times in different parts of the forum.

This wastes time. Don't do it.

I've deleted the duplicates for you (my time wasted).

You have now posted three random pieces of code that you have found on the Internet, I am not sure where that gets us.
You clearly do not understand anything of what you are doing. What you are trying to do is too much for your skill level. You don't actually want help, you want someone to do your project for you. Here we are good at giving help but not so keen to do things for you.

You could post in the collaborations section, but better would be to take things slowly and try and learn something about coding. Then you can ask for help for what you don't understand.
The point is that you do not ask a proper question.
It tells you in that sticky post how to ask a proper question.

thanks guys for all your help i going to try and study how code works i got as far as getting working on my arduino uno
with the 4x20 lcd sorry for wasting your time i wont ask for help any more

It's perfectly OK to ask for help here, but you need to show some effort and progress towards your goals, and not expect someone else to pick apart your code and put it together for you.

Just to be clear (and before I actually jump in and try to dive through this code), the 4x20 lcd you are using. Is that one of Dr. Liu's 4x20 phi shields, or is it a generic, bare lcd? I ask, because his phi shields have quite a bit of smarts that I suspect the sketches you are trying to use need to take advantage of. I wouldn't expect any sketch that has "phi" in the name to work on a generic, bare lcd module.

Edit: Change "dumb lcd" to "bare lcd". Negative connotations weren't intended and not noticed until re-reading this post a day later.

yes it is Dr. Liu's 4x20 phi shield

Does he have examples that work on your hardware to prove it is good?