Skip to content

Instantly share code, notes, and snippets.

@RobolinkAkademi
Last active October 28, 2019 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobolinkAkademi/41eac47e5558487dc3b9cc0227c53111 to your computer and use it in GitHub Desktop.
Save RobolinkAkademi/41eac47e5558487dc3b9cc0227c53111 to your computer and use it in GitHub Desktop.
tum_yil_icin_arduino_mufredati_25.2
#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