#include <LiquidCrystal.h> #include <Timer.h> #include <RTClib.h> #define bTN A0 #define Blink 13 //#define t0Out 0 //#define t1Out 1 #define ON LOW //HIGH #define OFF HIGH //LOW byte tONJam[] = {0,0,0,0,0,0,0,0,0}; //Setiap array berisi 8 bit data, untuk menyimpan nilai jam 00 sampai 23 byte tOFFJam[] = {0,0,0,0,0,0,0,0,0}; byte tONMnt[] = {0,0,0,0,0,0,0,0,0}; //Setiap array berisi 8 bit data, untuk menyimpan nilai menit 00 sampai 59 byte tOFFMnt[] = {0,0,0,0,0,0,0,0,0}; byte tONOFFPilih = 0; int jamTON, mntTON, jamTOFF, mntTOFF, tDtk, mntTunggu; int jam, mnt, dtk, tgl, bln , thn; long val; int j, i, n, x; bool setting = false; int adcKeyIn = 0; LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //7, 8, 9, 10, 11, 12); RTC_DS3231 rtc; //RTC_DS1307 rtc; Timer tBlink, tMain, tHold ; byte puncak[8] = { B00100, B01110, B11111, B11111, B01110, B01110, B01110, }; byte tinggi[8] = { B11111, B01110, B01110, B01110, B01110, B11111, B11111, }; void setup() { //Serial.begin(9600); lcd.begin(16, 2); rtc.begin(); pinMode(Blink, OUTPUT); pinMode(2, OUTPUT); pinMode(3, OUTPUT); lcd.createChar(0, puncak); lcd.createChar(1, tinggi); tBlink.oscillate(Blink, 500, LOW); tMain.every(800, realTimeScanTimerAktif); //tMain.every(800, realTimeScanTimerAktif2); tMain.every(5000, intSlide); tHold.every(1000, holdTime); //rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); //rtc.adjust(DateTime(2017, 10, 7, 11, 18, 30)); //t = 0; digitalWrite(3, HIGH); //suara dalam 24 jam on } //=================================================================== void loop() { DateTime now = rtc.now(); int alm = now.second() % 2; if (alm == 1) { //if (now.hour() >= 16 && now.hour() < 19) //{ realTimeScanTimerAktif(); //} //if (now.hour() >= 4 && now.hour() < 7) //{ //realTimeScanTimerAktif2(); //} } if (btnPressed() == 'S' ) { // Tombol OK / Select setting = true; } while (setting) { menuSetting(); } //iconMasjidLCD(); tampilJAM(); slideShowTimerAktif(); if (!setting) { tBlink.update(); tMain.update(); } } //=================================================================== void displayTON(byte jamTN, byte mntTN) { //lcd.clear(); lcd.setCursor(6, 1); lcd.print(konversi(jamTN)); lcd.setCursor(8, 1); lcd.print(':'); lcd.setCursor(9, 1); lcd.print(konversi(mntTN)); tMain.update(); } //=================================================================== void slideShowTimerAktif() { //get_float_time_parts(times[j], jamSholat, mntSholat); //mntSholat += selisihWaktu; if (mntTON >= 60) { mntTON = 0; jamTON++; } if (j == 8) { } //tampilTimerAktif(j, jamSholat, mntSholat); } //=================================================================== void realTimeScanTimerAktif() { readAllEEPROM(); DateTime now = rtc.now(); if (now.hour() >= 16 && now.hour() < 19) { x = 8; //EEPROM Allday 2 } if (now.hour() >= 4 && now.hour() < 7) { x = 7; //EEPROM AllDay 1 } int valON = (tONJam[x] * 100) + tONMnt[x]; int valOFF = (tOFFJam[x] * 100) + tOFFMnt[x]; if (tONOFFPilih == 1) { //nyala all days if (valON > valOFF) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) <= 2359)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= 0) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } } else if (valON < valOFF) { if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) <= 2359)) { digitalWrite(2, LOW); } else if ((((now.hour() * 100) + now.minute()) >= 0) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } } else if (valON == 0) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < 2359)) { digitalWrite(2, LOW); } } else if (valOFF == 0) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < 2359)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } } else if (valON == valOFF) { digitalWrite(2, LOW); } } } /* //=================================================================== void realTimeScanTimerAktif2() { readAllEEPROM(); DateTime now = rtc.now(); int valON = (tONJam[8] * 100) + tONMnt[8]; int valOFF = (tOFFJam[8] * 100) + tOFFMnt[8]; if (tONOFFPilih == 1) { //nyala all days if (valON > valOFF) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) <= 2359)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= 0) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } } else if (valON < valOFF) { if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) <= 2359)) { digitalWrite(2, LOW); } else if ((((now.hour() * 100) + now.minute()) >= 0) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } } else if (valON == 0) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < valOFF)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < 2359)) { digitalWrite(2, LOW); } } else if (valOFF == 0) { if ((((now.hour() * 100) + now.minute()) >= valON) && (((now.hour() * 100) + now.minute()) < 2359)) { digitalWrite(2, HIGH); } else if ((((now.hour() * 100) + now.minute()) >= valOFF) && (((now.hour() * 100) + now.minute()) < valON)) { digitalWrite(2, LOW); } } else if (valON == valOFF) { digitalWrite(2, LOW); } } } */ //=================================================================== void intSlide() { lcd.clear(); if (n > 1) { n = 0; } switch (n) { case 0 : j = 8; break; // Suara luar case 1 : j = 0; break; // Suara Dalam } n++; } //=================================================================== void holdTime() { tDtk++; if (tDtk >= 60) { mntTunggu++; tDtk = 0; } } //=================================================================== void resetHoldTime() { tDtk = 0; mntTunggu = 0; } //=================================================================== String konversi(int num) { if (num < 10) return "0" + String(num); else return String(num); } //=================================================================== void iconMasjidLCD() { lcd.setCursor(0, 0); lcd.write(byte(0)); lcd.setCursor(0, 1); lcd.write(byte(1)); lcd.setCursor(15, 0); lcd.write(byte(0)); lcd.setCursor(15, 1); lcd.write(byte(1)); } void tampilJAM() { DateTime now = rtc.now(); byte _thn = now.year() - 2000; // Tampilan Jam lcd.setCursor(1, 0); lcd.print(konversi(now.hour())); lcd.setCursor(3, 0); if (digitalRead(Blink) == LOW) { lcd.print(':'); } else { lcd.print(' '); } lcd.setCursor(4, 0); lcd.print(konversi(now.minute())); // Tampilan Tanggal lcd.setCursor(7, 0); lcd.print(konversi(now.day())); lcd.setCursor(9, 0); lcd.print('/'); lcd.setCursor(10, 0); lcd.print(konversi(now.month())); lcd.setCursor(12, 0); lcd.print('/'); lcd.setCursor(13, 0); lcd.print(konversi(_thn)); } //=================================================================== void displayRTC(byte _t, byte _b, byte _d, byte _j, byte _m) { // Tampilan Jam //lcd.clear(); lcd.setCursor(1, 1); lcd.print(konversi(_j)); lcd.setCursor(3, 1); lcd.print(':'); lcd.setCursor(4, 1); lcd.print(konversi(_m)); // Tampilan Tanggal lcd.setCursor(7, 1); lcd.print(konversi(_d)); lcd.setCursor(9, 1); lcd.print('/'); lcd.setCursor(10, 1); lcd.print(konversi(_b)); lcd.setCursor(12, 1); lcd.print('/'); lcd.setCursor(13, 1); lcd.print(konversi(_t)); } //============================================================ void readRTC() { DateTime now = rtc.now(); thn = now.year() - 2000; bln = now.month(); tgl = now.day(); jam = now.hour(); mnt = now.minute(); }
Skecth Setting:
//================================================================================================================== void readAllEEPROM() { tONJam[0] = eeprom_read_byte((uint8_t*)0); // Timer On Minggu JAM tOFFJam[0] = eeprom_read_byte((uint8_t*)1); // Timer Off Minggu JAM tONJam[1] = eeprom_read_byte((uint8_t*)2); // Timer On Senin JAM tOFFJam[1] = eeprom_read_byte((uint8_t*)3); // Timer Off Senin tONJam[2] = eeprom_read_byte((uint8_t*)4); // Timer On Selasa tOFFJam[2] = eeprom_read_byte((uint8_t*)5); // Timer Off Selasa tONJam[3] = eeprom_read_byte((uint8_t*)6); // Timer On Rabu tOFFJam[3] = eeprom_read_byte((uint8_t*)7); // Timer Off Rabu tONJam[4] = eeprom_read_byte((uint8_t*)8); // Timer On Kamis tOFFJam[4] = eeprom_read_byte((uint8_t*)9); // Timer Off Kamis tONJam[5] = eeprom_read_byte((uint8_t*)10); // Timer On Jum'at tOFFJam[5] = eeprom_read_byte((uint8_t*)11); // Timer Off Jum'at tONJam[6] = eeprom_read_byte((uint8_t*)12); // Timer On Sabtu tOFFJam[6] = eeprom_read_byte((uint8_t*)13); // Timer Off Sabtu tONMnt[0] = eeprom_read_byte((uint8_t*)14); // Timer On Minggu MENIT tOFFMnt[0] = eeprom_read_byte((uint8_t*)15); // Timer Off Minggu MENIT tONMnt[1] = eeprom_read_byte((uint8_t*)16); // Timer On Senin MENIT tOFFMnt[1] = eeprom_read_byte((uint8_t*)17); // Timer Off Senin MENIT tONMnt[2] = eeprom_read_byte((uint8_t*)18); // Timer On Selasa MENIT tOFFMnt[2] = eeprom_read_byte((uint8_t*)19); // Timer Off Selasa MENIT tONMnt[3] = eeprom_read_byte((uint8_t*)20); // Timer On Rabu MENIT tOFFMnt[3] = eeprom_read_byte((uint8_t*)21); // Timer Off Rabu MENIT tONMnt[4] = eeprom_read_byte((uint8_t*)22); // Timer On Kamis MENIT tOFFMnt[4] = eeprom_read_byte((uint8_t*)23); // Timer Off Kamis MENIT tONMnt[5] = eeprom_read_byte((uint8_t*)24); // Timer On Jum'at MENIT tOFFMnt[5] = eeprom_read_byte((uint8_t*)25); // Timer Off Jum'at MENIT tONMnt[6] = eeprom_read_byte((uint8_t*)26); // Timer On Sabtu MENIT tOFFMnt[6] = eeprom_read_byte((uint8_t*)27); // Timer Off Sabtu MENIT tONJam[7] = eeprom_read_byte((uint8_t*)28); // Timer On All Days tOFFJam[7] = eeprom_read_byte((uint8_t*)29); // Timer Off All Days tONMnt[7] = eeprom_read_byte((uint8_t*)30); // Timer On All Days MENIT tOFFMnt[7] = eeprom_read_byte((uint8_t*)31); // Timer Off All Days MENIT tONJam[8] = eeprom_read_byte((uint8_t*)33); // Timer On All Days tOFFJam[8] = eeprom_read_byte((uint8_t*)34); // Timer Off All Days tONMnt[8] = eeprom_read_byte((uint8_t*)35); // Timer On All Days MENIT tOFFMnt[8] = eeprom_read_byte((uint8_t*)36); // Timer Off All Days MENIT tONOFFPilih = eeprom_read_byte((uint8_t*)32); // Timer On Off All Days PILIH } //============================================================ void menuSetting() { DateTime now = rtc.now(); readRTC(); lcd.clear(); int tahun; //============================================================ setTGL: lcd.setCursor(0, 0); lcd.print(" Set TGL "); displayRTC(thn, bln, tgl, jam, mnt); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setBLN; } else if (btnPressed() == 'U') { tgl++; if (tgl >= 31) tgl = 0; } else if (btnPressed() == 'D') { tgl--; if (tgl < 0) tgl = 31; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } now = rtc.now(); tahun = thn + 2000; rtc.adjust(DateTime(now.year(), now.month(), tgl, now.hour(), now.minute(), now.second())); goto setTGL; //============================================================ setBLN: //lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Set BLN "); displayRTC(thn, bln, tgl, jam, mnt); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTHN; } else if (btnPressed() == 'U') { bln++; if (bln > 12) bln = 1; } else if (btnPressed() == 'D') { bln--; if (bln < 1) bln = 12; } else if (btnPressed() == 'L') { lcd.clear(); goto setTGL; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } now = rtc.now(); tahun = thn + 2000; rtc.adjust(DateTime(now.year(), bln, now.day(), now.hour(), now.minute(), now.second())); goto setBLN; //============================================================ setTHN: //lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Set THN "); displayRTC(thn, bln, tgl, jam, mnt); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setJAM; } else if (btnPressed() == 'U') { thn++; if (thn > 40) thn = 20; } else if (btnPressed() == 'D') { thn--; if (thn < 20) thn = 20; } else if (btnPressed() == 'L') { lcd.clear(); goto setBLN; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } now = rtc.now(); tahun = thn + 2000; rtc.adjust(DateTime(tahun, now.month(), now.day(), now.hour(), now.minute(), now.second())); //delay(300); goto setTHN; //============================================================ setJAM: //lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Set JAM "); displayRTC(thn, bln, tgl, jam, mnt); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setMNT; } else if (btnPressed() == 'U') { jam++; if (jam >= 24) jam = 0; } else if (btnPressed() == 'D') { jam--; if (jam < 0) jam = 23; } else if (btnPressed() == 'L') { lcd.clear(); goto setTHN; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } now = rtc.now(); tahun = thn + 2000; rtc.adjust(DateTime(now.year(), now.month(), now.day(), jam, now.minute(), now.second())); goto setJAM; //============================================================ setMNT: //lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Set MNT "); displayRTC(thn, bln, tgl, jam, mnt); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONAllDaysPilih; } else if (btnPressed() == 'U') { mnt++; if (mnt >= 60) mnt = 0; } else if (btnPressed() == 'D') { mnt--; if (mnt < 0) mnt = 59; } else if (btnPressed() == 'L') { lcd.clear(); goto setJAM; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } now = rtc.now(); tahun = thn + 2000; rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), mnt, now.second())); goto setMNT; //=================================================================== //=================================================================== setTONAllDaysPilih: readAllEEPROM(); //tONOFFPilih = tONOFPilih; lcd.setCursor(0, 0); lcd.print("Timer All Days ?"); lcd.setCursor(0, 1); if (tONOFFPilih==0) { lcd.print(" TIDAK "); } else { lcd.print(" YA "); } delay(200); if (btnPressed() == 'R') { lcd.clear(); if (tONOFFPilih==0) { goto setTONJamSenin; } if (tONOFFPilih==1) { goto setTimerForAllDaysONJAM; } } else if (btnPressed() == 'U') { eeprom_write_byte((uint8_t*)32, 1); lcd.setCursor(0, 1); lcd.print(" YA "); //t = 1; } else if (btnPressed() == 'D') { eeprom_write_byte((uint8_t*)32, 0); lcd.setCursor(0, 1); lcd.print(" TIDAK "); //t = 0; } else if (btnPressed() == 'L') { goto setMNT; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONAllDaysPilih; //=================================================================== setTimerForAllDaysONJAM: readAllEEPROM(); jamTON = tONJam[7]; mntTON = tONMnt[7]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Jam T-ON AllDay"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysONMENIT; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)28, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)28, jamTON); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTONAllDaysPilih; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysONJAM; //=================================================================== setTimerForAllDaysONMENIT: readAllEEPROM(); jamTON = tONJam[7]; mntTON = tONMnt[7]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Menit TON AllDay"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysOFFJAM; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)30, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)30, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTimerForAllDaysONJAM; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysONMENIT; //=================================================================== setTimerForAllDaysOFFJAM: readAllEEPROM(); jamTOFF = tOFFJam[7]; mntTOFF = tOFFMnt[7]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF AllDay"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysOFFMENIT; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)29, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)29, jamTOFF); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTimerForAllDaysONMENIT; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysOFFJAM; //=================================================================== setTimerForAllDaysOFFMENIT: readAllEEPROM(); jamTOFF = tOFFJam[7]; mntTOFF = tOFFMnt[7]; lcd.setCursor(0, 0); lcd.print("Menit TOF AllDay"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysONJAM2; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)31, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)31, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTimerForAllDaysOFFJAM; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysOFFMENIT; //=================================================================== //=================================================================== setTimerForAllDaysONJAM2: readAllEEPROM(); jamTON = tONJam[8]; mntTON = tONMnt[8]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Jam T-ON AllDay2"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysONMENIT2; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)33, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)33, jamTON); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTimerForAllDaysOFFMENIT; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysONJAM2; //=================================================================== setTimerForAllDaysONMENIT2: readAllEEPROM(); jamTON = tONJam[8]; mntTON = tONMnt[8]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Mnt T-ON AllDay2"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysOFFJAM2; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)35, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)35, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTimerForAllDaysONJAM2; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysONMENIT2; //=================================================================== setTimerForAllDaysOFFJAM2: readAllEEPROM(); jamTOFF = tOFFJam[8]; mntTOFF = tOFFMnt[8]; lcd.setCursor(0, 0); lcd.print("JAM TOFF AllDay2"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTimerForAllDaysOFFMENIT2; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)34, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)34, jamTOFF); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTimerForAllDaysONMENIT2; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysOFFJAM2; //=================================================================== setTimerForAllDaysOFFMENIT2: readAllEEPROM(); jamTOFF = tOFFJam[8]; mntTOFF = tOFFMnt[8]; lcd.setCursor(0, 0); lcd.print("Mnt TOF AllDay2"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); //goto setTONJamSenin; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)36, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)36, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTimerForAllDaysOFFJAM2; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTimerForAllDaysOFFMENIT2; //=================================================================== //=================================================================== setTONJamSenin: readAllEEPROM(); jamTON = tONJam[1]; mntTON = tONMnt[1]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Jam T-ON Senin "); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntSenin; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)2, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)2, jamTON); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTONAllDaysPilih; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamSenin; //=================================================================== setTONMntSenin: readAllEEPROM(); jamTON = tONJam[1]; mntTON = tONMnt[1]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Menit T-ON Senin"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamSenin; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)16, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)16, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamSenin; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntSenin; //=================================================================== setTOFFJamSenin: readAllEEPROM(); jamTOFF = tOFFJam[1]; mntTOFF = tOFFMnt[1]; lcd.setCursor(0, 0); lcd.print(" JAM T-OFF Senin "); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntSenin; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)3, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)3, jamTOFF); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTONMntSenin; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamSenin; //=================================================================== setTOFFMntSenin: readAllEEPROM(); jamTOFF = tOFFJam[1]; mntTOFF = tOFFMnt[1]; lcd.setCursor(0, 0); lcd.print(" Menit T-OFF Senin "); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamSelasa; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)17, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)17, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamSenin; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntSenin; //=================================================================== //=================================================================== setTONJamSelasa: readAllEEPROM(); jamTON = tONJam[2]; mntTON = tONMnt[2]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Jam T-ON Selasa"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntSelasa; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)4, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)4, jamTON); } else if (btnPressed() == 'L') { //eeprom_write_byte((uint8_t*)2, val); lcd.clear(); goto setTOFFMntSenin; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamSelasa; //=================================================================== setTONMntSelasa: readAllEEPROM(); jamTON = tONJam[2]; mntTON = tONMnt[2]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Menit T-ON Selasa"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamSelasa; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)18, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)18, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamSelasa; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntSelasa; //=================================================================== setTOFFJamSelasa: readAllEEPROM(); jamTOFF = tOFFJam[2]; mntTOFF = tOFFMnt[2]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Selasa"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntSelasa; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)5, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)5, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntSelasa; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamSelasa; //=================================================================== setTOFFMntSelasa: readAllEEPROM(); jamTOFF = tOFFJam[2]; mntTOFF = tOFFMnt[2]; lcd.setCursor(0, 0); lcd.print(" Menit T-OFF Selasa "); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamRabu; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)19, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)19, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamSelasa; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntSelasa; //=================================================================== //=================================================================== setTONJamRabu: readAllEEPROM(); jamTON = tONJam[3]; mntTON = tONMnt[3]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Jam T-ON Rabu"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntRabu; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)6, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)6, jamTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFMntSelasa; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamRabu; //=================================================================== setTONMntRabu: readAllEEPROM(); jamTON = tONJam[3]; mntTON = tONMnt[3]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Menit T-ON Rabu"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamRabu; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)20, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)20, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamRabu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntRabu; //=================================================================== setTOFFJamRabu: readAllEEPROM(); jamTOFF = tOFFJam[3]; mntTOFF = tOFFMnt[3]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Rabu"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntRabu; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)7, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)7, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntRabu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamRabu; //=================================================================== setTOFFMntRabu: readAllEEPROM(); jamTOFF = tOFFJam[3]; mntTOFF = tOFFMnt[3]; lcd.setCursor(0, 0); lcd.print(" Menit T-OFF Rabu "); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamKamis; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)23, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)23, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamRabu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntRabu; //=================================================================== //=================================================================== setTONJamKamis: readAllEEPROM(); jamTON = tONJam[4]; mntTON = tONMnt[4]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Jam T-ON Kamis"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntKamis; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)8, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)8, jamTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFMntRabu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamKamis; //=================================================================== setTONMntKamis: readAllEEPROM(); jamTON = tONJam[4]; mntTON = tONMnt[4]; //delay(1000); //lcd.clear(); lcd.setCursor(0, 0); lcd.print("Menit T-ON Kamis"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamKamis; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)22, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)22, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamKamis; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntKamis; //=================================================================== setTOFFJamKamis: readAllEEPROM(); jamTOFF = tOFFJam[4]; mntTOFF = tOFFMnt[4]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Kamis"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntKamis; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)9, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)9, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntKamis; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamKamis; //=================================================================== setTOFFMntKamis: readAllEEPROM(); jamTOFF = tOFFJam[4]; mntTOFF = tOFFMnt[4]; lcd.setCursor(0, 0); lcd.print("Menit T-OFF Kamis"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamJumat; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)23, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)23, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamKamis; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntKamis; //=================================================================== //=================================================================== setTONJamJumat: readAllEEPROM(); jamTON = tONJam[5]; mntTON = tONMnt[5]; lcd.setCursor(0, 0); lcd.print("Jam T-ON Jumat"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntJumat; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)10, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)10, jamTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFMntKamis; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamJumat; //=================================================================== setTONMntJumat: readAllEEPROM(); jamTON = tONJam[5]; mntTON = tONMnt[5]; lcd.setCursor(0, 0); lcd.print("Menit T-ON Jumat"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamJumat; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)24, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)24, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamJumat; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntJumat; //=================================================================== setTOFFJamJumat: readAllEEPROM(); jamTOFF = tOFFJam[5]; mntTOFF = tOFFMnt[5]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Jumat"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntJumat; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)11, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)11, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntJumat; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamJumat; //=================================================================== setTOFFMntJumat: readAllEEPROM(); jamTOFF = tOFFJam[5]; mntTOFF = tOFFMnt[5]; lcd.setCursor(0, 0); lcd.print("Menit T-OFF Jumat"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamSabtu; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)25, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)25, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamJumat; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntJumat; //=================================================================== //=================================================================== setTONJamSabtu: readAllEEPROM(); jamTON = tONJam[6]; mntTON = tONMnt[6]; lcd.setCursor(0, 0); lcd.print("Jam T-ON Sabtu"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntSabtu; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)12, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)12, jamTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFMntJumat; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamSabtu; //=================================================================== setTONMntSabtu: readAllEEPROM(); jamTON = tONJam[6]; mntTON = tONMnt[6]; lcd.setCursor(0, 0); lcd.print("Menit T-ON Sabtu"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamSabtu; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)26, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)26, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamSabtu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntSabtu; //=================================================================== setTOFFJamSabtu: readAllEEPROM(); jamTOFF = tOFFJam[6]; mntTOFF = tOFFMnt[6]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Sabtu"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntSabtu; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)13, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)13, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntSabtu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamSabtu; //=================================================================== setTOFFMntSabtu: readAllEEPROM(); jamTOFF = tOFFJam[6]; mntTOFF = tOFFMnt[6]; lcd.setCursor(0, 0); lcd.print("Menit T-OFF Sabtu"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONJamMinggu; } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)27, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)27, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamSabtu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntSabtu; //=================================================================== //=================================================================== setTONJamMinggu: readAllEEPROM(); jamTON = tONJam[0]; mntTON = tONMnt[0]; lcd.setCursor(0, 0); lcd.print("Jam T-ON Minggu"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTONMntMinggu; } else if (btnPressed() == 'U') { jamTON++; if (jamTON > 23) jamTON = 0; eeprom_write_byte((uint8_t*)0, jamTON); } else if (btnPressed() == 'D') { jamTON--; if (jamTON < 0) jamTON = 23; eeprom_write_byte((uint8_t*)0, jamTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFMntSabtu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONJamMinggu; //=================================================================== setTONMntMinggu: readAllEEPROM(); jamTON = tONJam[0]; mntTON = tONMnt[0]; lcd.setCursor(0, 0); lcd.print("Menit T-ON Mingg"); displayTON(jamTON, mntTON); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFJamMinggu; } else if (btnPressed() == 'U') { mntTON++; if (mntTON > 59) mntTON = 0; eeprom_write_byte((uint8_t*)14, mntTON); } else if (btnPressed() == 'D') { mntTON--; if (mntTON < 0) mntTON = 59; eeprom_write_byte((uint8_t*)14, mntTON); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONJamMinggu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTONMntMinggu; //=================================================================== setTOFFJamMinggu: readAllEEPROM(); jamTOFF = tOFFJam[0]; mntTOFF = tOFFMnt[0]; lcd.setCursor(0, 0); lcd.print("JAM T-OFF Minggu"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { lcd.clear(); goto setTOFFMntMinggu; } else if (btnPressed() == 'U') { jamTOFF++; if (jamTOFF > 23) jamTOFF = 0; eeprom_write_byte((uint8_t*)1, jamTOFF); } else if (btnPressed() == 'D') { jamTOFF--; if (jamTOFF < 0) jamTOFF = 23; eeprom_write_byte((uint8_t*)1, jamTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTONMntMinggu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFJamMinggu; //=================================================================== setTOFFMntMinggu: readAllEEPROM(); jamTOFF = tOFFJam[0]; mntTOFF = tOFFMnt[0]; lcd.setCursor(0, 0); lcd.print("Menit T-OFF Ming"); displayTON(jamTOFF, mntTOFF); delay(200); if (btnPressed() == 'R') { } else if (btnPressed() == 'U') { mntTOFF++; if (mntTOFF > 59) mntTOFF = 0; eeprom_write_byte((uint8_t*)15, mntTOFF); } else if (btnPressed() == 'D') { mntTOFF--; if (mntTOFF < 0) mntTOFF = 59; eeprom_write_byte((uint8_t*)15, mntTOFF); } else if (btnPressed() == 'L') { lcd.clear(); goto setTOFFJamMinggu; } else if (btnPressed() == 'S') { lcd.clear(); goto setEND; } goto setTOFFMntMinggu; //=================================================================== setEND: setting = false; delay(500); lcd.clear(); } //=================================================================== char btnPressed() { adcKeyIn = analogRead(bTN); if (adcKeyIn < 60) { return 'R'; } else if (adcKeyIn < 200) { return 'U'; } else if (adcKeyIn < 400){ return 'D'; } else if (adcKeyIn < 600){ return 'L'; } else if (adcKeyIn < 800){ return 'S'; } else { return 'O'; } }
Kedua sketch disimpan dalam satu folder.
Video Hasil / Demo:
Tidak ada komentar:
Posting Komentar