[csharp] ce
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- #include <LiquidCrystal.h>
- #include <RTClib.h>
- #include <Wire.h>
- RTC_DS1307 RTC;
- LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
- int LampuTeras = 3;
- int LampuBalkon = 4;
- int LampuTengah = 5;
- int LampuKamar = 6;
- int jam, menit, detik, tanggal, bulan, tahun, hari;
- char temp[33];
- char namahari[7][8] = {"Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"};
- void setup() {
- Serial.begin(115200);
- RTC.begin();
- lcd.begin(16, 2);// put your setup code here, to run once:
- pinMode(3, OUTPUT);
- pinMode(4, OUTPUT);
- pinMode(5, OUTPUT);
- pinMode(6, OUTPUT);
- lcd.setCursor(4, 0);
- lcd.print("KELOMPOK");
- lcd.setCursor(7, 1);
- lcd.print("02");
- delay(1000);
- lcd.clear();
- }
- void loop() {
- DateTime now = RTC.now();
- jam = now.hour();
- menit = now.minute();
- detik = now.second();
- tanggal = now.day();
- bulan = now.month();
- tahun = now.year();
- hari = now.dayOfTheWeek();
- sprintf(temp, "%02d:%02d:%02d WIB", jam, menit, detik);
- lcd.setCursor(2, 0);
- lcd.print(temp);
- sprintf(temp, "%s,%02d/%02d/%02d", namahari[hari], tanggal, bulan, tahun);
- lcd.setCursor(0, 1);
- lcd.print(temp);
- if (jam == 18 && menit == 00 && detik == 00) {
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- }
- if (jam == 17 && menit == 00 && detik == 00) {
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- }
- else if (jam == 06 && menit == 00 && detik == 00) {
- digitalWrite(3, LOW);
- digitalWrite(4, LOW);
- digitalWrite(5, LOW);
- digitalWrite(6, LOW);
- }
- // put your main code here, to run repeatedly:
- }
Editor
You can edit this paste and save as new: