Clock Set Date Time

Clock LCD display adjustable.

Jan 25, 2017

146703 views

105 respects

Components and supplies

1

Standard LCD - 16x2 White on Blue

1

Real Time Clock (RTC)

3

Pushbutton switch 12mm

1

I2C module for LCD

3

Resistor 10k ohm

1

Arduino UNO

1

Jumper wires (generic)

Project description

Code

Downloadable files

Eletric scheme

Eletric scheme

Fritzing scheme

Fritzing scheme

Fritzing scheme

Fritzing scheme

Eletric scheme

Eletric scheme

Fritzing scheme Jpeg

Fritzing scheme Jpeg

Comments

Only logged in users can leave comments

Anonymous user

2 years ago

Please someone tell me..what are steps that i need to learn in order to create rtc.h library file it is really complex. Please guide me. I want to create my own library as above

Anonymous user

2 years ago

no matching function for call to 'LiquidCrystal_I2C::begin()' show this messege what i do

Anonymous user

2 years ago

Try use lcd.int(); instead of lcd.begin();

Anonymous user

2 years ago

hello sir when i verify then show the error lcd.begin(); what i do

Anonymous user

2 years ago

Try use lcd.init();

Anonymous user

2 years ago

I try it. But it is not work. The display show Date: day/mount/year Hour: hour/minit/sec The button can not work

Anonymous user

2 years ago

Hello, I use a very similar code i get on the web, but i have the problem i have to use "Alarm.alarmrepeat", with this code to read a variable and then activate some relay, but i couldn't get it work, sorry for my english, if someone can help me i will be very greatfull

tittiamo68

2 years ago

Hi Lucas I did not understand what you want to do. Maybe an alarm clock?

Anonymous user

2 years ago

Hi tittiamo Yes, I have something like this void setup(){ (There is all the code of the post) pinMode(13,OUTPUT); Alarm.alarmrepeat(19,0,0, Ledhigh);//this is that I added in setup } Ledhigh(){ digitalWrite(13,HIGH); } //Is a really simple code but that function that I added doesn't respond, idk if I can't use it with the etc. I think the problem can be because the time is declared on the loop, but I don't really know Thanks for your attention

tittiamo68

2 years ago

Your problem is to let the "Time.h" library speak with the "RTClib.h" library https://www.pjrc.com/teensy/td_libs_TimeAlarms.html https://www.pjrc.com/teensy/td_libs_Time.html Changing the "RTClib.h" library would mean upsetting my code. You could try with: https://www.hackster.io/Tittiamo/alarm-clock-f61bad

Anonymous user

2 years ago

bro this code doesn't working for me. it shows-- no matching function for call to 'LiquidCrystal_I2C::begin()' ############the error was ############## Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno" C:\\Users\\DELL\\Documents\\Arduino\\RTC_CLOCK_WITH_BUTTON\\RTC_CLOCK_WITH_BUTTON.ino: In function 'void setup()': RTC_CLOCK_WITH_BUTTON:48:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ In file included from C:\\Users\\DELL\\Documents\\Arduino\\RTC_CLOCK_WITH_BUTTON\\RTC_CLOCK_WITH_BUTTON.ino:17:0: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate: virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); ^ C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate expects 3 arguments, 0 provided Multiple libraries were found for "LiquidCrystal_I2C.h" Used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()' This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Anonymous user

2 years ago

waiting for your replay

tittiamo68

2 years ago

You have a library problem. Check that the "LiquidCrystal_I2C.h" library (https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library) is well installed (read the instructions). Let me know

Anonymous user

2 years ago

Excellent project! Can I replace the 3 resistors as in protoboard by adding in the sketch as below? pinMode (P1, INPUT_PULLUP); pinMode (P2, INPUT_PULLUP); pinMode (P3, INPUT_PULLUP); Thanks

Anonymous user

2 years ago

Hello Sir I have used this code but it work auto loop time and date on lcd. What false ? Can you tell me this error, please?

Anonymous user

2 years ago

Please help me to change the Day of the week by Switch

Anonymous user

2 years ago

i copy this code and then add all library but when i want verify the code has error .please help me

tittiamo68

2 years ago

To help you have to write the error

Anonymous user

2 years ago

Hello all, I got the clock running at least and had just to change the Liquid LCD settings. With the settings from the sketch my LCD screen did just show up some non sens. I changed the LCD setting as follows and it works super now: // I2C,RS,RW,EN,D4,D5,D6,D7,BL,ACTIVE) LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); void setup() { lcd.begin(16, 2); Very nice project and I plan to use it as a carclock in combination with a micro Arduino. After success I'll post a picture. Molto grazie e ciao tutti!!

Anonymous user

2 years ago

I followed the connection and the coding, even change "0x3F" to the number shown during scanning. But my LCD only has the backlight on and shows 1 row of blocks. I reconnected the connections but still the same outcome.. any advice or help.. thank you (am a beginner in this)

Anonymous user

2 years ago

I am trying to make this project, however, my LCD screen shows nothing. My connections are correct and my code has no errors, yet the LCD has the back-light but no text. Can you help me out please?

tittiamo68

2 years ago

The problem you're having is: LiquidCrystal_I2C LCD (0x3F, 16.2); // I2C display 16 x 2. I suggest you read "http://playground.arduino.cc/Main/I2cScanner". The address of my Display is: "0x3F", replace this value with yours

Anonymous user

2 years ago

Thanks a lot! It worked.

Anonymous user

2 years ago

Hello !! I tried your code but the display shows some random data on the date like: Date:125/00/204 And the time keeps running like a random cronometer as Time:102:03:000 Time:87:117:11 I checked, checked and rechecked and i cant find what to do. Eventually from time to time the serial monitor shows RTC Not Working. Can you help me please?

Anonymous user

2 years ago

Hi there,i was looking for a combination in which ds 1307module can be set manually and also the display to be on i2c.I assemblied all the piese program my arduino nano and after the restart on the lcd are starting to appear all kinds of characters in one single row.do you have any ideea why? Thanks

tittiamo68

2 years ago

Did you use my code? Have you checked that the display address "(LiquidCrystal_I2C lcd(0x3F,16,2);)" is correct? Let me know.

tittiamo68

2 years ago

See also my project: https://www.hackster.io/Tittiamo/weather-clock-c7e040

Anonymous user

2 years ago

I saw this project today and in the meanwhile i tested different version ,resulting that in the end to put the same subroutines in the same places that you putted in the weather project, with the exception that i created an display code for Celsius degree( Char(223)).Anymay thank you for this 2 projects.

Anonymous user

2 years ago

Yes but after test i realized that the F letter was with f, and i made some modification like in the void setup i put at the start lcd.init(); and on the lcd.begin(16, 2); instead of lcd.begin();. Now i am trying to introduce two routine to display temperature and humidity from an dht22 sensor. Thanks

Anonymous user

2 years ago

Thank you for this project. It has helped me alot with my OLED + RTC clock. I changed the code to accept SD 1306 (128x64) OLED screen instead of the LCD. Everything is working but the screen keeps flickering. I'm not experienced enough to find out why it's flickering. I think working OLED version of this code would be useful to many people today. Here is the sketch if someone wants to take a look at it and try to find out if it can be fixed. https://pastebin.com/afRJb1NN

Anonymous user

2 years ago

I spent ages trying to work out how to create an equiv to __DATE__,__TIME__ that is used to set the rtc in most samples RTC.adjust(DateTime(__DATE__, __TIME__)); and then I came across your code. RTC.adjust(DateTime(yearupg, monthupg, dayupg, hourupg, minupg, 0)); Thank you :-)

tittiamo68

2 years ago

I am happy that it was useful

Anonymous user

2 years ago

could you make a video to show what it displays please

Anonymous user

2 years ago

There is a small bug in DisplaySetMonth procedure, when You press "-" button: void DisplaySetMonth() { // Setting the month lcd.clear(); if(digitalRead(P2)==HIGH) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(digitalRead(P3)==HIGH) { if (monthupg==12) // MMac - should by (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); delay(200); }

tittiamo68

2 years ago

I thank you for reporting this my error. I corrected the code if(digitalRead(P3)==HIGH) { if (monthupg==1) // correction { monthupg=12; } else { monthupg=monthupg-1;

Anonymous user

2 years ago

good tutorial, if someone helps me how to do so that the rtc ds3231 is updated at the time of an internet server using esp8266, in such a way that the time is always updated, I have problems with the rtc 1307 much ahead, that's why I look for other alternatives thanks, I leave my mail to send me email information: parabanunezpablo@gmail.com

Anonymous user

2 years ago

interesting project, but you could simplify the circuit by eliminating the three resistors R1 , R2, R3 using the internal pull-up with pinMode (pin, INPUT_PULLUP). Also you could connect a cheaper LCD with 4-wire bus.

tittiamo68

2 years ago

Thank you John I listened to your advice and I made an alarm. I've published in "https://www.hackster.io/Tittiamo/alarm-clock-f61bad" I'd love your opinion. Hello Titian

tittiamo68

2 years ago

Thanks for the suggestion, for the next project I have already eliminated the resistance and modified the pins in INPUT_PULLUP, and reversed the code logic. The display I used already has I2C interface, but I failed to find it in Fritzing

Anonymous user

2 years ago

ma siete italiani, parlate in italiano madonna cara

Anonymous user

2 years ago

You could simplify it further by using two buttons instead of three, like I did in my project here: https://forum.arduino.cc/index.php?topic=408565.0

Anonymous user

2 years ago

Can you do this build without the I2C module and if so how?

tittiamo68

2 years ago

There are several tutorials that explain how to use the LCD without I2c: https://www.hackster.io/Arduino_Scuola/arduino-and-lcds-605d7f https://www.hackster.io/arduino-projects/arduino-tutorial-lcd-display-cb2834 https://www.instructables.com/id/How-to-use-an-LCD-displays-Arduino-Tutorial/

danasofts

2 years ago

I have tried your code and it works well Great and Thankyou I have made some modifications which will enable you to use a single Analog port to adjust the clock there by saving 2 i/o for you Further I have included a small function to display the day of week I am pasting the Modified Sketch where I have used a normal LCD which suits my Board /* :Project:Clock_Set_Date_Time :Author: Tiziano Bianchettin :Date: 13/01/2017 :Revision: 1 :License: Public Domain thanks to: http://arduinoenonsolo.blogspot.it/2012/12/orologio-con-arduino-e-il-ds1307.html http://www.mauroalfieri.it/ http://www.danielealberti.it/ http://www.maffucci.it/ My electronics laboratory professor "Perito Carli" Modified by Annamalai Ananthapadmanabhan on 08-04-2020 */ //************libraries**************// #include <Wire.h> #include <RTClib.h> //#include <LiquidCrystal_I2C.h> #include <LiquidCrystal.h> //************************************// //LiquidCrystal_I2C lcd(0x3F,16,2); // Display I2C 16 x 2 LiquidCrystal lcd(2,3,4,5,6,7); // Display I2C 16 x 2 RTC_DS1307 RTC; //************Button*****************// int P1=1; // Button SET MENU' int P2=2; // Button + int P3=3; // Button - //************Variables**************// int hourupg; int minupg; int yearupg; int monthupg; int dayupg; int menu =0; char* dayName[] = {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; int right=50; // https://www.freetronics.com.au/pages/16x2-lcd-shield-quickstart-guide#.Xo6xmBKSw3A int up=250; // refer schematic and check values and alter accordingly int down=500; int left=700; int Select=900; int evaluateButton(int x) { int result = 0; if (x < right) { result = 1; // right } else if ( x < up) { result = 2; // up } else if ( x < down) { result = 3; // down } else if ( x < left) { result = 4; // left } else if ( x < Select) { result = 5; // Select } return result; } void setup() { /* lcd.begin(); lcd.backlight(); lcd.clear(); */ lcd.begin(16,2); // pinMode(P1,INPUT); // pinMode(P2,INPUT); // pinMode(P3,INPUT); pinMode(A0,INPUT); pinMode(13,OUTPUT); pinMode(10,OUTPUT); // Serial.begin(9600); Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { lcd.print("RTC is NOT running!"); // Serial.println("RTC is NOT running!"); // Set the date and time at compile time RTC.adjust(DateTime(__DATE__, __TIME__)); } // RTC.adjust(DateTime(__DATE__, __TIME__)); //removing "//" to adjust the time // The default display shows the date and time int menu=0; } void loop() { Disp_time(); //Serial.println(now.second()); } void Disp_time() { // check if you press the SET button and increase the menu index if(evaluateButton(analogRead(A0))==1) { menu=menu+1; } // in which subroutine should we go? if (menu==0) { DisplayDateTime(); // void DisplayDateTime } if (menu==1) { DisplaySetHour(); } if (menu==2) { DisplaySetMinute(); } if (menu==3) { DisplaySetYear(); } if (menu==4) { DisplaySetMonth(); } if (menu==5) { DisplaySetDay(); } if (menu==6) { StoreAgg(); delay(500); menu=0; } delay(100); } void DisplayDateTime () { // We show the current date and time DateTime now = RTC.now(); lcd.setCursor(0, 1); // lcd.print("Hour:"); if (now.hour()<=9) { lcd.print("0"); } lcd.print(now.hour(), DEC); hourupg=now.hour(); lcd.print(":"); if (now.minute()<=9) { lcd.print("0"); } lcd.print(now.minute(), DEC); minupg=now.minute(); lcd.print(":"); if (now.second()<=9) { lcd.print("0"); } lcd.print(now.second(), DEC); if (digitalRead(13)==1) {lcd.print("-Bell ON");} else {lcd.print("-Bell OFF");} // lcd.print("-");lcd.print(dayName[weekday(now.year(), now.month(),now.day())]); lcd.setCursor(0, 0); // lcd.print("Date:"); if (now.day()<=9) { lcd.print("0"); } lcd.print(now.day(), DEC); dayupg=now.day(); lcd.print("/"); if (now.month()<=9) { lcd.print("0"); } lcd.print(now.month(), DEC); monthupg=now.month(); lcd.print("/"); lcd.print(now.year(), DEC); yearupg=now.year(); lcd.print("-");lcd.print(dayName[weekday(now.year(), now.month(),now.day())]); } void DisplaySetHour() { // time setting lcd.clear(); DateTime now = RTC.now(); if(evaluateButton(analogRead(A0))==2) { if(hourupg==23) { hourupg=0; } else { hourupg=hourupg+1; } } if(evaluateButton(analogRead(A0))==3) { if(hourupg==0) { hourupg=23; } else { hourupg=hourupg-1; } } lcd.setCursor(0,0); lcd.print("Set time:"); lcd.setCursor(0,1); lcd.print(hourupg,DEC); delay(200); } void DisplaySetMinute() { // Setting the minutes lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (minupg==59) { minupg=0; } else { minupg=minupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (minupg==0) { minupg=59; } else { minupg=minupg-1; } } lcd.setCursor(0,0); lcd.print("Set Minutes:"); lcd.setCursor(0,1); lcd.print(minupg,DEC); delay(200); } void DisplaySetYear() { // setting the year lcd.clear(); if(evaluateButton(analogRead(A0))==2) { yearupg=yearupg+1; } if(evaluateButton(analogRead(A0))==3) { yearupg=yearupg-1; } lcd.setCursor(0,0); lcd.print("Set Year:"); lcd.setCursor(0,1); lcd.print(yearupg,DEC); delay(200); } void DisplaySetMonth() { // Setting the month lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); delay(200); } void DisplaySetDay() { // Setting the day lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (dayupg==31) { dayupg=1; } else { dayupg=dayupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (dayupg==1) { dayupg=31; } else { dayupg=dayupg-1; } } lcd.setCursor(0,0); lcd.print("Set Day:"); lcd.setCursor(0,1); lcd.print(dayupg,DEC); delay(200); } void StoreAgg() { // Variable saving lcd.clear(); lcd.setCursor(0,0); lcd.print("SAVING IN"); lcd.setCursor(0,1); lcd.print("PROGRESS"); RTC.adjust(DateTime(yearupg,monthupg,dayupg,hourupg,minupg,0)); delay(200); } int weekday(int year, int month, int day) /* Calculate day of week in proleptic Gregorian calendar. Sunday == 0. */ { int adjustment, mm, yy; if (year<2000) year+=2000; adjustment = (14 - month) / 12; mm = month + 12 * adjustment - 2; yy = year - adjustment; return (day + (13 * mm - 1) / 5 + yy + yy / 4 - yy / 100 + yy / 400) % 7; }

Anonymous user

2 years ago

My Arduino IDE Ver 1.8.13 found fault with the code line: lcd.begin(): Changing the line to: lcd.init(); solved the problem.

Anonymous user

2 years ago

Hi, great tutorial! Can I suggest some code improvements? If I am in a DisplaySet* mode, the LCD is blinking because of the `lcd.clear();` in every DisplaySet* method. If you put the `lcd.clear();` into the `if(digitalRead(P1))` and remove from every DisplaySet* method, the LCD won't be blinking. Unfortunately the numbers < 10 won't clear the numbers > 10 after the decrease, so you need to put a space after the printed numbers to "clear" the LCD correctly. in the loop method: ``` if(digitalRead(P1)) { menu=menu+1; lcd.clear(); } ``` and the other methods: ``` void DisplaySetHour() { // time setting DateTime now = RTC.now(); if(digitalRead(P2)==HIGH) { if(hourupg==23) { hourupg=0; } else { hourupg=hourupg+1; } } if(digitalRead(P3)==HIGH) { if(hourupg==0) { hourupg=23; } else { hourupg=hourupg-1; } } lcd.setCursor(0,0); lcd.print("Set Hours:"); lcd.setCursor(0,1); lcd.print(hourupg,DEC); lcd.print(" "); delay(200); } void DisplaySetMinute() { // Setting the minutes if(digitalRead(P2)==HIGH) { if (minupg==59) { minupg=0; } else { minupg=minupg+1; } } if(digitalRead(P3)==HIGH) { if (minupg==0) { minupg=59; } else { minupg=minupg-1; } } lcd.setCursor(0,0); lcd.print("Set Minutes:"); lcd.setCursor(0,1); lcd.print(minupg,DEC); lcd.print(" "); delay(200); } void DisplaySetYear() { // setting the year if(digitalRead(P2)==HIGH) { yearupg=yearupg+1; } if(digitalRead(P3)==HIGH) { yearupg=yearupg-1; } lcd.setCursor(0,0); lcd.print("Set Year:"); lcd.setCursor(0,1); lcd.print(yearupg,DEC); lcd.print(" "); delay(200); } void DisplaySetMonth() { // Setting the month if(digitalRead(P2)==HIGH) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(digitalRead(P3)==HIGH) { if (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); lcd.print(" "); delay(200); } void DisplaySetDay() { // Setting the day if(digitalRead(P2)==HIGH) { if (dayupg==31) { dayupg=1; } else { dayupg=dayupg+1; } } if(digitalRead(P3)==HIGH) { if (dayupg==1) { dayupg=31; } else { dayupg=dayupg-1; } } lcd.setCursor(0,0); lcd.print("Set Day:"); lcd.setCursor(0,1); lcd.print(dayupg,DEC); lcd.print(" "); delay(200); } ```

Anonymous user

2 years ago

hello please tell me how to change Day of the Week

tittiamo68

2 years ago

The day of the week changes automatically. RTC knows that 7 July is Sunday

Anonymous user

2 years ago

hello please tell me how to change 24hr formate to 12 hr formate

tittiamo68

2 years ago

it should work, I have not had time to try it [code] void DisplayDateTime () { // We show the current date and time DateTime now = RTC.now(); lcd.setCursor(0, 1); lcd.print("Hour:"); if (now.hour()>12) { hourpm = now.hour()-12; if (hourpm()<=9) { lcd.print("0"); } lcd.print(hourpm, DEC); } else { if (now.hour()<=9) { lcd.print("0"); } lcd.print(now.hour(), DEC); } hourupg=now.hour(); lcd.print(":"); if (now.minute()<=9) { lcd.print("0"); } lcd.print(now.minute(), DEC); minupg=now.minute(); lcd.print(":"); if (now.second()<=9) { lcd.print("0"); } lcd.print(now.second(), DEC); if (now.hour()>12) { lcd.print("PM"); } else { lcd.print("AM"); } [/code]

Anonymous user

2 years ago

Very good tutorial! If I may ask, will this code work with DS3231? Thank you!

Anonymous user

2 years ago

I followed your tutorial and used DS3231 instead. Following your advise above, the DS3231 worked with RTC lib and I used it together with a DS3231 library to get the temperature read out. Thanks a lot!

tittiamo68

2 years ago

If, in the code, change the RTC_DS1037 with RTC_DS3231, the RTC library does not work. I tried connecting the DS3231, without declaring it in the code, and it works.

tittiamo68

2 years ago

I'm happy to have been helpful

Anonymous user

2 years ago

Hey there, that was a great project! Is it possible to use an OLED Display instead of a LCD? If so, what changes are required?

Anonymous user

2 years ago

Thanks for your code. It saved me some time. Cheers!

Anonymous user

2 years ago

hi am new, i want to make one project please help me. i want to set time and repeat something, for example shine red light and other time shine green led. please give me arduino code

isusciuc

2 years ago

I tried to build this project and I used a I2C LCD display 20 x 4 character.The I2C LCD is based on MCP23008 IC.I have nothing on LCD (backlighnt OFF, no character) although I have no error while compiling and uploading the code.Is something I missed?I need some other libraries?

isusciuc

2 years ago

I checked adresses with serial monitor and I found 0x20for the LCD and 0x50 , 0x68 for RTC.I tried to adjust contrast but nothing happend.I even forced the LCD to ligh-up by connecting pin 16 of LCD to GND.Indeed, the back-light (blue) turned ON, but 2 of the 4 rows were entirely white. If I had your email adress, I coud send you some pictures.The I2C adapter of LCD based on MCP23008 has some pads which can be soldered on PCB. There is a command which I can send in serial monitor to return the date and time?Thank you.

isusciuc

2 years ago

Luckely, I found on Github 2 libraries (hd44780.h and hd44780ioClass/hd44780_I2Cexp.h) and with small changes in your code the clock seems to be working.There is also a usefull tool I2CexpDiag.Thank you very much, you were so kind!

tittiamo68

2 years ago

Did you try adjusting the contrast pot, the square blue thing with the screwdriver slot on the back of the backpack?

jeffmon500

2 years ago

Well done tittiamo. I really enjoyed going through your code. One question, you use the DS1307 RTC but will this sketch work with any RTC such as the very popular DS3231? Many thanks Jeff Monegal

Anonymous user

2 years ago

Hello !! I tried your code but the display shows some random data on the date like: Date:125/00/204 And the time keeps running like a random cronometer as Time:102:03:000 Time:87:117:11 I checked, checked and rechecked and i cant find what to do. Eventually from time to time the serial monitor shows RTC Not Working. Can you help me please?

natethegreatdesigner

3 years ago

could you make a video to show what it displays please

Anonymous user

3 years ago

I try it. But it is not work. The display show Date: day/mount/year Hour: hour/minit/sec The button can not work

Anonymous user

3 years ago

Hello Sir I have used this code but it work auto loop time and date on lcd. What false ? Can you tell me this error, please?

Sigee

4 years ago

Hi, great tutorial! Can I suggest some code improvements? If I am in a DisplaySet* mode, the LCD is blinking because of the `lcd.clear();` in every DisplaySet* method. If you put the `lcd.clear();` into the `if(digitalRead(P1))` and remove from every DisplaySet* method, the LCD won't be blinking. Unfortunately the numbers < 10 won't clear the numbers > 10 after the decrease, so you need to put a space after the printed numbers to "clear" the LCD correctly. in the loop method: ``` if(digitalRead(P1)) { menu=menu+1; lcd.clear(); } ``` and the other methods: ``` void DisplaySetHour() { // time setting DateTime now = RTC.now(); if(digitalRead(P2)==HIGH) { if(hourupg==23) { hourupg=0; } else { hourupg=hourupg+1; } } if(digitalRead(P3)==HIGH) { if(hourupg==0) { hourupg=23; } else { hourupg=hourupg-1; } } lcd.setCursor(0,0); lcd.print("Set Hours:"); lcd.setCursor(0,1); lcd.print(hourupg,DEC); lcd.print(" "); delay(200); } void DisplaySetMinute() { // Setting the minutes if(digitalRead(P2)==HIGH) { if (minupg==59) { minupg=0; } else { minupg=minupg+1; } } if(digitalRead(P3)==HIGH) { if (minupg==0) { minupg=59; } else { minupg=minupg-1; } } lcd.setCursor(0,0); lcd.print("Set Minutes:"); lcd.setCursor(0,1); lcd.print(minupg,DEC); lcd.print(" "); delay(200); } void DisplaySetYear() { // setting the year if(digitalRead(P2)==HIGH) { yearupg=yearupg+1; } if(digitalRead(P3)==HIGH) { yearupg=yearupg-1; } lcd.setCursor(0,0); lcd.print("Set Year:"); lcd.setCursor(0,1); lcd.print(yearupg,DEC); lcd.print(" "); delay(200); } void DisplaySetMonth() { // Setting the month if(digitalRead(P2)==HIGH) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(digitalRead(P3)==HIGH) { if (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); lcd.print(" "); delay(200); } void DisplaySetDay() { // Setting the day if(digitalRead(P2)==HIGH) { if (dayupg==31) { dayupg=1; } else { dayupg=dayupg+1; } } if(digitalRead(P3)==HIGH) { if (dayupg==1) { dayupg=31; } else { dayupg=dayupg-1; } } lcd.setCursor(0,0); lcd.print("Set Day:"); lcd.setCursor(0,1); lcd.print(dayupg,DEC); lcd.print(" "); delay(200); } ```

Anonymous user

4 years ago

My Arduino IDE Ver 1.8.13 found fault with the code line: lcd.begin(): Changing the line to: lcd.init(); solved the problem.

Anonymous user

4 years ago

I followed the connection and the coding, even change "0x3F" to the number shown during scanning. But my LCD only has the backlight on and shows 1 row of blocks. I reconnected the connections but still the same outcome.. any advice or help.. thank you (am a beginner in this)

danasofts

5 years ago

I have tried your code and it works well Great and Thankyou I have made some modifications which will enable you to use a single Analog port to adjust the clock there by saving 2 i/o for you Further I have included a small function to display the day of week I am pasting the Modified Sketch where I have used a normal LCD which suits my Board /* :Project:Clock_Set_Date_Time :Author: Tiziano Bianchettin :Date: 13/01/2017 :Revision: 1 :License: Public Domain thanks to: http://arduinoenonsolo.blogspot.it/2012/12/orologio-con-arduino-e-il-ds1307.html http://www.mauroalfieri.it/ http://www.danielealberti.it/ http://www.maffucci.it/ My electronics laboratory professor "Perito Carli" Modified by Annamalai Ananthapadmanabhan on 08-04-2020 */ //************libraries**************// #include <Wire.h> #include <RTClib.h> //#include <LiquidCrystal_I2C.h> #include <LiquidCrystal.h> //************************************// //LiquidCrystal_I2C lcd(0x3F,16,2); // Display I2C 16 x 2 LiquidCrystal lcd(2,3,4,5,6,7); // Display I2C 16 x 2 RTC_DS1307 RTC; //************Button*****************// int P1=1; // Button SET MENU' int P2=2; // Button + int P3=3; // Button - //************Variables**************// int hourupg; int minupg; int yearupg; int monthupg; int dayupg; int menu =0; char* dayName[] = {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; int right=50; // https://www.freetronics.com.au/pages/16x2-lcd-shield-quickstart-guide#.Xo6xmBKSw3A int up=250; // refer schematic and check values and alter accordingly int down=500; int left=700; int Select=900; int evaluateButton(int x) { int result = 0; if (x < right) { result = 1; // right } else if ( x < up) { result = 2; // up } else if ( x < down) { result = 3; // down } else if ( x < left) { result = 4; // left } else if ( x < Select) { result = 5; // Select } return result; } void setup() { /* lcd.begin(); lcd.backlight(); lcd.clear(); */ lcd.begin(16,2); // pinMode(P1,INPUT); // pinMode(P2,INPUT); // pinMode(P3,INPUT); pinMode(A0,INPUT); pinMode(13,OUTPUT); pinMode(10,OUTPUT); // Serial.begin(9600); Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { lcd.print("RTC is NOT running!"); // Serial.println("RTC is NOT running!"); // Set the date and time at compile time RTC.adjust(DateTime(__DATE__, __TIME__)); } // RTC.adjust(DateTime(__DATE__, __TIME__)); //removing "//" to adjust the time // The default display shows the date and time int menu=0; } void loop() { Disp_time(); //Serial.println(now.second()); } void Disp_time() { // check if you press the SET button and increase the menu index if(evaluateButton(analogRead(A0))==1) { menu=menu+1; } // in which subroutine should we go? if (menu==0) { DisplayDateTime(); // void DisplayDateTime } if (menu==1) { DisplaySetHour(); } if (menu==2) { DisplaySetMinute(); } if (menu==3) { DisplaySetYear(); } if (menu==4) { DisplaySetMonth(); } if (menu==5) { DisplaySetDay(); } if (menu==6) { StoreAgg(); delay(500); menu=0; } delay(100); } void DisplayDateTime () { // We show the current date and time DateTime now = RTC.now(); lcd.setCursor(0, 1); // lcd.print("Hour:"); if (now.hour()<=9) { lcd.print("0"); } lcd.print(now.hour(), DEC); hourupg=now.hour(); lcd.print(":"); if (now.minute()<=9) { lcd.print("0"); } lcd.print(now.minute(), DEC); minupg=now.minute(); lcd.print(":"); if (now.second()<=9) { lcd.print("0"); } lcd.print(now.second(), DEC); if (digitalRead(13)==1) {lcd.print("-Bell ON");} else {lcd.print("-Bell OFF");} // lcd.print("-");lcd.print(dayName[weekday(now.year(), now.month(),now.day())]); lcd.setCursor(0, 0); // lcd.print("Date:"); if (now.day()<=9) { lcd.print("0"); } lcd.print(now.day(), DEC); dayupg=now.day(); lcd.print("/"); if (now.month()<=9) { lcd.print("0"); } lcd.print(now.month(), DEC); monthupg=now.month(); lcd.print("/"); lcd.print(now.year(), DEC); yearupg=now.year(); lcd.print("-");lcd.print(dayName[weekday(now.year(), now.month(),now.day())]); } void DisplaySetHour() { // time setting lcd.clear(); DateTime now = RTC.now(); if(evaluateButton(analogRead(A0))==2) { if(hourupg==23) { hourupg=0; } else { hourupg=hourupg+1; } } if(evaluateButton(analogRead(A0))==3) { if(hourupg==0) { hourupg=23; } else { hourupg=hourupg-1; } } lcd.setCursor(0,0); lcd.print("Set time:"); lcd.setCursor(0,1); lcd.print(hourupg,DEC); delay(200); } void DisplaySetMinute() { // Setting the minutes lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (minupg==59) { minupg=0; } else { minupg=minupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (minupg==0) { minupg=59; } else { minupg=minupg-1; } } lcd.setCursor(0,0); lcd.print("Set Minutes:"); lcd.setCursor(0,1); lcd.print(minupg,DEC); delay(200); } void DisplaySetYear() { // setting the year lcd.clear(); if(evaluateButton(analogRead(A0))==2) { yearupg=yearupg+1; } if(evaluateButton(analogRead(A0))==3) { yearupg=yearupg-1; } lcd.setCursor(0,0); lcd.print("Set Year:"); lcd.setCursor(0,1); lcd.print(yearupg,DEC); delay(200); } void DisplaySetMonth() { // Setting the month lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); delay(200); } void DisplaySetDay() { // Setting the day lcd.clear(); if(evaluateButton(analogRead(A0))==2) { if (dayupg==31) { dayupg=1; } else { dayupg=dayupg+1; } } if(evaluateButton(analogRead(A0))==3) { if (dayupg==1) { dayupg=31; } else { dayupg=dayupg-1; } } lcd.setCursor(0,0); lcd.print("Set Day:"); lcd.setCursor(0,1); lcd.print(dayupg,DEC); delay(200); } void StoreAgg() { // Variable saving lcd.clear(); lcd.setCursor(0,0); lcd.print("SAVING IN"); lcd.setCursor(0,1); lcd.print("PROGRESS"); RTC.adjust(DateTime(yearupg,monthupg,dayupg,hourupg,minupg,0)); delay(200); } int weekday(int year, int month, int day) /* Calculate day of week in proleptic Gregorian calendar. Sunday == 0. */ { int adjustment, mm, yy; if (year<2000) year+=2000; adjustment = (14 - month) / 12; mm = month + 12 * adjustment - 2; yy = year - adjustment; return (day + (13 * mm - 1) / 5 + yy + yy / 4 - yy / 100 + yy / 400) % 7; }

yusiskan

5 years ago

hi, nice work, i like it. I tried it with DS1302 RTC module but serial screen is saying "RTC is NOT working". does it work with work with DS1302?. and How ? can you help me ? I am using DS1302 another my project and it is working. best regards.

tittiamo68

2 years ago

Unfortunately it cannot work because the DS1302 has an SPI interface while the DS1307 has an I2C interface. You have to change the layout, libraries and code. Ciao Tiziano

Anonymous user

5 years ago

Excellent project! Can I replace the 3 resistors as in protoboard by adding in the sketch as below? pinMode (P1, INPUT_PULLUP); pinMode (P2, INPUT_PULLUP); pinMode (P3, INPUT_PULLUP); Thanks

Anonymous user

5 years ago

Please someone tell me..what are steps that i need to learn in order to create rtc.h library file it is really complex. Please guide me. I want to create my own library as above

Anonymous user

5 years ago

hi am new, i want to make one project please help me. i want to set time and repeat something, for example shine red light and other time shine green led. please give me arduino code

Anonymous user

5 years ago

no matching function for call to 'LiquidCrystal_I2C::begin()' show this messege what i do

Anonymous user

2 years ago

Try use lcd.int(); instead of lcd.begin();

Anonymous user

5 years ago

hello sir when i verify then show the error lcd.begin(); what i do

Anonymous user

2 years ago

Try use lcd.init();

allesklusser

5 years ago

Hello all, I got the clock running at least and had just to change the Liquid LCD settings. With the settings from the sketch my LCD screen did just show up some non sens. I changed the LCD setting as follows and it works super now: // I2C,RS,RW,EN,D4,D5,D6,D7,BL,ACTIVE) LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); void setup() { lcd.begin(16, 2); Very nice project and I plan to use it as a carclock in combination with a micro Arduino. After success I'll post a picture. Molto grazie e ciao tutti!!

Anonymous user

5 years ago

Thank you for this project. It has helped me alot with my OLED + RTC clock. I changed the code to accept SD 1306 (128x64) OLED screen instead of the LCD. Everything is working but the screen keeps flickering. I'm not experienced enough to find out why it's flickering. I think working OLED version of this code would be useful to many people today. Here is the sketch if someone wants to take a look at it and try to find out if it can be fixed. https://pastebin.com/afRJb1NN

Anonymous user

6 years ago

hello please tell me how to change Day of the Week

tittiamo68

2 years ago

The day of the week changes automatically. RTC knows that 7 July is Sunday

Anonymous user

6 years ago

Please help me to change the Day of the week by Switch

Anonymous user

6 years ago

good tutorial, if someone helps me how to do so that the rtc ds3231 is updated at the time of an internet server using esp8266, in such a way that the time is always updated, I have problems with the rtc 1307 much ahead, that's why I look for other alternatives thanks, I leave my mail to send me email information: parabanunezpablo@gmail.com

Anonymous user

6 years ago

Hey there, that was a great project! Is it possible to use an OLED Display instead of a LCD? If so, what changes are required?

Anonymous user

6 years ago

Thanks for your code. It saved me some time. Cheers!

Anonymous user

6 years ago

bro this code doesn't working for me. it shows-- no matching function for call to 'LiquidCrystal_I2C::begin()' ############the error was ############## Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno" C:\\Users\\DELL\\Documents\\Arduino\\RTC_CLOCK_WITH_BUTTON\\RTC_CLOCK_WITH_BUTTON.ino: In function 'void setup()': RTC_CLOCK_WITH_BUTTON:48:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ In file included from C:\\Users\\DELL\\Documents\\Arduino\\RTC_CLOCK_WITH_BUTTON\\RTC_CLOCK_WITH_BUTTON.ino:17:0: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate: virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); ^ C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate expects 3 arguments, 0 provided Multiple libraries were found for "LiquidCrystal_I2C.h" Used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master Not used: C:\\Users\\DELL\\Documents\\Arduino\\libraries\\Arduino-LiquidCrystal-I2C-library-master exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()' This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

tittiamo68

2 years ago

You have a library problem. Check that the "LiquidCrystal_I2C.h" library (https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library) is well installed (read the instructions). Let me know

Anonymous user

2 years ago

waiting for your replay

Anonymous user

6 years ago

i copy this code and then add all library but when i want verify the code has error .please help me

tittiamo68

2 years ago

To help you have to write the error

Anonymous user

6 years ago

hello please tell me how to change 24hr formate to 12 hr formate

tittiamo68

2 years ago

it should work, I have not had time to try it [code] void DisplayDateTime () { // We show the current date and time DateTime now = RTC.now(); lcd.setCursor(0, 1); lcd.print("Hour:"); if (now.hour()>12) { hourpm = now.hour()-12; if (hourpm()<=9) { lcd.print("0"); } lcd.print(hourpm, DEC); } else { if (now.hour()<=9) { lcd.print("0"); } lcd.print(now.hour(), DEC); } hourupg=now.hour(); lcd.print(":"); if (now.minute()<=9) { lcd.print("0"); } lcd.print(now.minute(), DEC); minupg=now.minute(); lcd.print(":"); if (now.second()<=9) { lcd.print("0"); } lcd.print(now.second(), DEC); if (now.hour()>12) { lcd.print("PM"); } else { lcd.print("AM"); } [/code]

Anonymous user

6 years ago

Hello, I use a very similar code i get on the web, but i have the problem i have to use "Alarm.alarmrepeat", with this code to read a variable and then activate some relay, but i couldn't get it work, sorry for my english, if someone can help me i will be very greatfull

tittiamo68

2 years ago

Your problem is to let the "Time.h" library speak with the "RTClib.h" library https://www.pjrc.com/teensy/td_libs_TimeAlarms.html https://www.pjrc.com/teensy/td_libs_Time.html Changing the "RTClib.h" library would mean upsetting my code. You could try with: https://www.hackster.io/Tittiamo/alarm-clock-f61bad

tittiamo68

2 years ago

Hi Lucas I did not understand what you want to do. Maybe an alarm clock?

Anonymous user

2 years ago

Hi tittiamo Yes, I have something like this void setup(){ (There is all the code of the post) pinMode(13,OUTPUT); Alarm.alarmrepeat(19,0,0, Ledhigh);//this is that I added in setup } Ledhigh(){ digitalWrite(13,HIGH); } //Is a really simple code but that function that I added doesn't respond, idk if I can't use it with the etc. I think the problem can be because the time is declared on the loop, but I don't really know Thanks for your attention

Anonymous user

7 years ago

Can you do this build without the I2C module and if so how?

tittiamo68

2 years ago

There are several tutorials that explain how to use the LCD without I2c: https://www.hackster.io/Arduino_Scuola/arduino-and-lcds-605d7f https://www.hackster.io/arduino-projects/arduino-tutorial-lcd-display-cb2834 https://www.instructables.com/id/How-to-use-an-LCD-displays-Arduino-Tutorial/

isusciuc

7 years ago

I tried to build this project and I used a I2C LCD display 20 x 4 character.The I2C LCD is based on MCP23008 IC.I have nothing on LCD (backlighnt OFF, no character) although I have no error while compiling and uploading the code.Is something I missed?I need some other libraries?

tittiamo68

2 years ago

Did you try adjusting the contrast pot, the square blue thing with the screwdriver slot on the back of the backpack?

isusciuc

2 years ago

I checked adresses with serial monitor and I found 0x20for the LCD and 0x50 , 0x68 for RTC.I tried to adjust contrast but nothing happend.I even forced the LCD to ligh-up by connecting pin 16 of LCD to GND.Indeed, the back-light (blue) turned ON, but 2 of the 4 rows were entirely white. If I had your email adress, I coud send you some pictures.The I2C adapter of LCD based on MCP23008 has some pads which can be soldered on PCB. There is a command which I can send in serial monitor to return the date and time?Thank you.

isusciuc

2 years ago

Luckely, I found on Github 2 libraries (hd44780.h and hd44780ioClass/hd44780_I2Cexp.h) and with small changes in your code the clock seems to be working.There is also a usefull tool I2CexpDiag.Thank you very much, you were so kind!

alok_shah

7 years ago

I am trying to make this project, however, my LCD screen shows nothing. My connections are correct and my code has no errors, yet the LCD has the back-light but no text. Can you help me out please?

alok_shah

2 years ago

Thanks a lot! It worked.

tittiamo68

2 years ago

The problem you're having is: LiquidCrystal_I2C LCD (0x3F, 16.2); // I2C display 16 x 2. I suggest you read "http://playground.arduino.cc/Main/I2cScanner". The address of my Display is: "0x3F", replace this value with yours

Anonymous user

7 years ago

Hi there,i was looking for a combination in which ds 1307module can be set manually and also the display to be on i2c.I assemblied all the piese program my arduino nano and after the restart on the lcd are starting to appear all kinds of characters in one single row.do you have any ideea why? Thanks

tittiamo68

2 years ago

Did you use my code? Have you checked that the display address "(LiquidCrystal_I2C lcd(0x3F,16,2);)" is correct? Let me know.

Anonymous user

2 years ago

I saw this project today and in the meanwhile i tested different version ,resulting that in the end to put the same subroutines in the same places that you putted in the weather project, with the exception that i created an display code for Celsius degree( Char(223)).Anymay thank you for this 2 projects.

Anonymous user

2 years ago

Yes but after test i realized that the F letter was with f, and i made some modification like in the void setup i put at the start lcd.init(); and on the lcd.begin(16, 2); instead of lcd.begin();. Now i am trying to introduce two routine to display temperature and humidity from an dht22 sensor. Thanks

tittiamo68

2 years ago

See also my project: https://www.hackster.io/Tittiamo/weather-clock-c7e040

Anonymous user

7 years ago

Very good tutorial! If I may ask, will this code work with DS3231? Thank you!

Anonymous user

2 years ago

I followed your tutorial and used DS3231 instead. Following your advise above, the DS3231 worked with RTC lib and I used it together with a DS3231 library to get the temperature read out. Thanks a lot!

tittiamo68

2 years ago

If, in the code, change the RTC_DS1037 with RTC_DS3231, the RTC library does not work. I tried connecting the DS3231, without declaring it in the code, and it works.

tittiamo68

2 years ago

I'm happy to have been helpful

gc_malcolm

7 years ago

I spent ages trying to work out how to create an equiv to __DATE__,__TIME__ that is used to set the rtc in most samples RTC.adjust(DateTime(__DATE__, __TIME__)); and then I came across your code. RTC.adjust(DateTime(yearupg, monthupg, dayupg, hourupg, minupg, 0)); Thank you :-)

tittiamo68

2 years ago

I am happy that it was useful

Anonymous user

8 years ago

There is a small bug in DisplaySetMonth procedure, when You press "-" button: void DisplaySetMonth() { // Setting the month lcd.clear(); if(digitalRead(P2)==HIGH) { if (monthupg==12) { monthupg=1; } else { monthupg=monthupg+1; } } if(digitalRead(P3)==HIGH) { if (monthupg==12) // MMac - should by (monthupg==1) { monthupg=12; } else { monthupg=monthupg-1; } } lcd.setCursor(0,0); lcd.print("Set Month:"); lcd.setCursor(0,1); lcd.print(monthupg,DEC); delay(200); }

tittiamo68

2 years ago

I thank you for reporting this my error. I corrected the code if(digitalRead(P3)==HIGH) { if (monthupg==1) // correction { monthupg=12; } else { monthupg=monthupg-1;

Anonymous user

8 years ago

interesting project, but you could simplify the circuit by eliminating the three resistors R1 , R2, R3 using the internal pull-up with pinMode (pin, INPUT_PULLUP). Also you could connect a cheaper LCD with 4-wire bus.

tittiamo68

2 years ago

Thanks for the suggestion, for the next project I have already eliminated the resistance and modified the pins in INPUT_PULLUP, and reversed the code logic. The display I used already has I2C interface, but I failed to find it in Fritzing

tittiamo68

2 years ago

Thank you John I listened to your advice and I made an alarm. I've published in "https://www.hackster.io/Tittiamo/alarm-clock-f61bad" I'd love your opinion. Hello Titian

cumonster104

2 years ago

ma siete italiani, parlate in italiano madonna cara

Anonymous user

2 years ago

You could simplify it further by using two buttons instead of three, like I did in my project here: https://forum.arduino.cc/index.php?topic=408565.0