When you say "it doesn't work", what do you mean?
Hey,
when I said it doesn't work, I ment this:
On first row, there is time, printed with itoa function (integers converted to string with itoa and then printed as "print(char s*), in second line, it is writen with function, that I added to lib (as mentioned in my first post).
The code, used in video:
#include <bv4618.h>
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h> // written by mattt on the Arduino forum and molcdfied by D. Sjunnesson
BV4618 lcd(0x31); // 0x62 I2C address (8 bit)
void setup()
{
Serial.begin(9600);
lcd.clear(); // clear screen
lcd.setdisplay(4,20); // set up lcdsplay geometry
}
void loop()
{
int hour, minute, second;
hour = RTC.get(DS1307_HR,true); //This is in military time [0,23]
minute = RTC.get(DS1307_MIN,false);
second = RTC.get(DS1307_SEC,false);
char hour_str[4]; // Define as a string
char minute_str[4];
char second_str[4];
lcd.setCursor(1,1);
if(hour < 10){
lcd.print("0");
}
lcd.print(itoa (hour, hour_str, 10)); //convert integer hour to string hour_str and print it on LCD
lcd.print(':');
if(minute < 10){
lcd.print("0");
}
lcd.print(itoa (minute, minute_str, 10));
lcd.print(':');
if(second < 10){
lcd.print("0");
}
lcd.print(itoa (second, second_str, 10));
lcd.setCursor(1,11);
/*************** PRINTS TIME "INTEGER" *****************/
lcd.setCursor(2,1);
if(hour < 10){
lcd.print("0");
}
lcd.print(hour);
lcd.print(':');
if(minute < 10){
lcd.print("0");
}
lcd.print(minute);
lcd.print(':');
if(second < 10){
lcd.print("0");
}
lcd.print(second);
}
It looks like you are using he code straight out of print(char). In that case it will likely take the low-order byte of the integer and print it as a character. I don't think that what you intend. You probably want to use itoa(n) and use the look from print(char *) to print the digits of the number.
Its complicated for me (I guess you already noticed, I'm very new to coding

).
I would like to add function to lib that when I write:
int hour
lcd.print(hour); //or maybe lcd.print(hour, DEC); ???
there would be the correct hour on the display

Any more help would be much appreciated.
Thank you in advance.