tum_yil_icin_arduino_mufredati_25.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal_I2C.h> //I2C modülün kütüphanesi | |
#include <Wire.h> | |
#include "RTClib.h"//RTC modül kütüphanesinin tanımlanması | |
LiquidCrystal_I2C lcd(0x27,16,2); //lcd ekran özellikleri | |
RTC_DS1307 RTC; | |
void setup() { | |
Wire.begin(); | |
RTC.begin(); | |
lcd.begin(); | |
if (! RTC.isrunning()) //RTC çalışmıyorsa | |
lcd.print("RTC Çalışmıyor"); | |
lcd.setCursor(0,0); | |
lcd.print("Saat ve Tarih"); | |
lcd.setCursor(0,1); | |
lcd.print("Bilgisi"); | |
delay(3000); | |
lcd.clear(); | |
RTC.adjust(DateTime(2018,11,12,12,8,30));//güncel saat bilgisi ayarı | |
} | |
void loop() { | |
DateTime now=RTC.now(); | |
lcd.setCursor(0,0); | |
lcd.print("Tarih:"); //tarih bilgilerinin yazılması | |
lcd.print(now.day(), DEC);//gün bilgisinin yazılması | |
lcd.print("/"); | |
lcd.print(now.month(),DEC);//ay bilgisinin yazılması | |
lcd.print("/"); | |
lcd.print(now.year(), DEC);//yıl bilgisinin yazılması | |
lcd.print(" "); | |
lcd.setCursor(0,1); | |
lcd.print("saat: "); //saat bilgilerinin yazılması | |
if (now.hour()<10) //eğer saat 10dan küçükse | |
lcd.print("0"); //0 yaz | |
lcd.print(now.hour(),DEC); //şuanki saati yaz | |
lcd.print(":"); | |
if(now.minute()<10) //eğer dakika 10dan küçükse | |
lcd.print("0"); //0 yaz | |
lcd.print(now.minute(), DEC);//şuanki dakikayı yaz | |
lcd.print(":"); | |
if(now.second()<10) //eğer saniye 10dan küçükse | |
lcd.print("0"); //0 yaz | |
lcd.print(now.second(), DEC); //şuanki saniyeyi yaz | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment