I am running this code copied from here http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227406778/all
Thiw code just count time since reset
I need to insert button for changing hours on counter.
Fow example if time is 3 hours and 32 min ,by pressing the button 2 times the new time will be 5 hours and 32 min.
I was tring to find command of change DateTime.Hour and DateTime.Day (etc DateTime.Hour++) but nothing happend
Anyone knows those commands (-- and ++) please help
#include <DateTime.h>
#include <LiquidCrystal.h>
int resetPin = 3; // pin 3 resets the time
//create object to control an LCD GMD1602K.
LiquidCrystal lcd(12, 11, 2, 7, 8, 9, 10);
void setup(){
digitalWrite(resetPin,HIGH); // this line enables pull-up
pinMode(13,OUTPUT); // we flash the LED each second
pinMode(resetPin, INPUT); // a button on this pin resets the time
DateTime.sync( 0 ); // set time to zero
}
void loop(){
if(digitalRead(resetPin) == LOW)
DateTime.sync( 0 ); // reset time to zero if button pressed
/* --------- Prints time in hours, minutes and seconds ----------- */
DateTime.available(); // needed to refresh the clock time
time_t timeNow = DateTime.now();
lcd.setCursor(0,0);
lcd.print(timeNow/60); // total elapsed minutes
lcd.setCursor(0,8);
lcd.print(timeNow/3600); // total elapsed seconds
lcd.setCursor(0,0);
lcd.print("Hour:min");
lcd.setCursor(10,0);
lcd.print(DateTime.Hour,DEC); // prints total hours (up to 24)
lcd.print(":");
lcd.print(DateTime.Minute,DEC); // and minutes since reset
lcd.setCursor(0,1);
lcd.print("Sec");
lcd.setCursor(10,1);
lcd.print(DateTime.Second,DEC); // and seconds since reset
lcd.print(" "); // clears second digit every minute
digitalWrite(13, LOW); //light the LED every second
delay (1000);
digitalWrite(13, HIGH); //
}