I have a Duemilanove hocked up to a LCD03 from robot electronics via I2C and a I2C RTC. The RTC works great along with the LCD. I can view the times view the serial port and put stuff on the LCD.
I now want to be able to display the time on the LCD. I am using the following to try and display the data on the LCD - "Wire.write(daynow);". I have played around with the data types but nothing I try works. If I use "Wire.write("04")"; Then it will work but does not seem to work with a variable.
I am using the following tutorial/libary to get the RTC to work - DS1307 RTC tutorial
DateTime now = RTC.now();
unsigned int hournow;
unsigned int minutenow;
unsigned int secondnow;
char daynow;
unsigned int monthnow;
unsigned int yearnow;
hournow = (now.hour(), DEC);
minutenow = (now.minute(), DEC);
secondnow = (now.second(), DEC);
daynow = (now.day(), DEC);
monthnow = (now.month(), DEC);
yearnow = (now.year(), DEC);
Wire.beginTransmission(address);
Wire.write(0);
Wire.write(2);
Wire.write(5);
delay(50);
Wire.write("Current time");
Wire.write(2);
Wire.write(47);
delay(50);
Wire.write(daynow);
Wire.endTransmission();
delay(50);
you have daynow as a char. this will only hold one asscii symbol. it needs to be a string i haven't used them on arduino so i'm not 100% on how to implemented them.
Thanks for the help! Getting closer but still got a problem.
If I use the code you suggested it prints 10:10:10 on the screen. I have just been playing around with it just now and found that the code below works great.