Help me Pls...
I making timer control on-off relay
it work. But i want Create Menu for set time please help
my code :
// Date and time functions using just software, based on millis() & timer
#include <Arduino.h>
#include <Wire.h> // this #include still required because the RTClib depends on it
#include "RTClib.h"
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
#define Serial SerialUSB
#endif
RTC_Millis rtc;
const int Relay1= 2; // output control relay
const int Relay2= 3;
const int Relay3= 4;
const int Relay4= 5;
const int SW_U = 10; // button switch pin
const int SW_D = 11;
const int SW_R = 12;
const int SW_L = A1;
const int SW_EN = A0;
///////////////////////////////////////
int P1_H = 19; // variable to set work ( I want set value by push buttons )
int P1_M = 15;
int P1_S = 5;
int P2_H = 19;
int P2_M = 16;
int P2_S = 4;
int P3_H = 0;
int P3_M = 0;
int P3_S = 0;
int P4_H = 0;
int P4_M = 0;
int P4_S = 0;
///////////////////////////////////////////////////////////
void setup ()
{
lcd.init();
lcd.backlight();
pinMode(Relay1,OUTPUT);
pinMode(Relay2,OUTPUT);
pinMode(Relay3,OUTPUT);
pinMode(Relay4,OUTPUT);
pinMode(SW_U,INPUT);
pinMode(SW_D,INPUT);
pinMode(SW_L,INPUT);
pinMode(SW_R,INPUT);
pinMode(SW_EN,INPUT);
digitalWrite(Relay1,HIGH); // set value high beceuse working signel low
digitalWrite(Relay2,HIGH);
digitalWrite(Relay3,HIGH);
digitalWrite(Relay4,HIGH);
Serial.begin(57600);
// following line sets the RTC to the date & time this sketch was compiled
rtc.begin(DateTime(F(DATE), F(TIME)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
void loop ()
{
printTime();
}
void printTime() {
DateTime now = rtc.now();
lcd.setCursor(1,0);
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
lcd.print(' ');
lcd.setCursor(11,0); // Time Clock
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(),DEC);
// Serial.print(" seconds since 1970: ");
// Serial.println(now.unixtime());
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.unixtime() + 7 * 86400L + 30);
Serial.println();
delay(1000);
}