Forstly thanks for all your replies, i have got so far with the project but come to a halt again,
i can display the date and time but when the numbers are between 1 and 9 the display only shows a single digit i.e. '5' not '05' my script is as follows so far.
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>
RTC_DS1307 RTC;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
RTC.begin();
Wire.begin();
if (! RTC.isrunning()) {
lcd.print("RTC NOT RUNNING!");
RTC.adjust(DateTime(DATE, TIME));
}
}
void loop () {
DateTime now = RTC.now();
lcd.setCursor(4, 0);
lcd.print(now.day(), DEC);
lcd.print('-');
lcd.print(now.month(), DEC);
lcd.print('-');
lcd.print(now.year(), DEC);
lcd.setCursor(4, 1);
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
delay(1000);
}
I thought it would be a simple case of adding the function
if(now.day < 10)
lcd.print('0');
for example for the day but when i do so all i get is an error saying
"invalid use of member (did you forget the '&' ?)
can anyone help me on this one please?
i did get this up and running properly yesterday but then lost my sketch (Lesson learned to back things up and save regularly)
This is the one final bit i would like to get resolved before it goes ion teh car.
thanks,
Phil.